Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set status code in Grape gem

How does one customise the status code response when using the Grape gem? e.g.

post do
   status = :accepted
   @order = Order.find(params[:id])
end

This can be achieved for with error!({ error: 'Order not found'}, 404) but how does one do it for non errors?

like image 509
TrevTheDev Avatar asked Jul 26 '14 06:07

TrevTheDev


1 Answers

Found the solution:

post do
  status 203
  @order = Order.find(params[:id])
end
like image 78
TrevTheDev Avatar answered Oct 22 '22 03:10

TrevTheDev