#1 2013-12-20 16:46:19

jvillasantegomez
Member
From: Ciudad Habana. Cuba.
Registered: 2013-10-21
Posts: 54

How to set custom status code

How would I set a custom status code on mormot?

I want, inside my services, to be able to set a custom http status code (say 500)

If possible, it would be nice to add a property to TServiceCustomAnswer for setting the status code, now you can set headers and body, but it would be nice to set the status code as well.

Regards...

Last edited by jvillasantegomez (2013-12-20 21:16:10)

Offline

#2 2013-12-29 14:47:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: How to set custom status code

By now, it expects HTML_SUCCESS (200) on the client side for any success full process.
See e.g. TServiceFactoryClient.InternalInvoke().

So allowing any custom code may be very difficult, and break the default expected behavior of the JSON-RPC protocol.

Note that if you raise an exception, it will return an error 500 to the client.

Perhaps you may consider using a method-based service instead (see the SAD 1.18 pdf), which will give you access to all call parameters, including HTTP status code.
See http://blog.synopse.info/post/2010/07/1 … phi-7-2010

Offline

Board footer

Powered by FluxBB