Http response status in headers or in content
I have to write an application which serves HTTP requests. For these
requests I have send the response content with status. Status is integer
which represents status code.( 1 : Session Expired, 2: Invalid Request
Data. etc,.)
There are 2 options.
One is to send the status code with content itself:
Ex : {status : 56, content: [{name:'pinto', id: 90}]}
Another one is specifying the status code in header itself, so that once I
receive the header from client if status states the there is an error I
can abort the request so that I don't have to receive the response body
and process it.
I think second option will be better than first one, because No need to
get for the response content which is very much helpful in case of content
is large.
Is this is recommended solution or any other suggestions ?
No comments:
Post a Comment