On Fri, 14 Nov 2014 08:12:26 GMT, Flamaros wrote:
I want to use some REST APIs but I don't understand what need to be done to be able to change the HTTP status of a post service.
I actually have :
interface MyAPI { void postNewsletter(string email); } class MyAPIImplementation : MyAPI { void postNewsletter(string email) { registerToNewsletter(email); } }
How I can manipulate the HTTPServerResponse will be sent to the client for the postNewsletter method?
The REST generator will returns 200 by default (or 204 if there's no content). A way to return another code is to throw an HTTPStatusException if you have an error.
Could you provide more info about your use case / what you are trying to achieve ?