api2go
api2go copied to clipboard
handleRead hardcodes http.StatusOk as status code
It is not possible to set a response status code via the response returned by FindOne; the status code is set to http.StatusOk. Would it be possible to add logic in handleRead to try to use response.StatusCode()?
The specification of jsonapi only specifies 200 for OK and 404 for not found. http://jsonapi.org/format/#fetching-resources
Could you describe your problem a little bit?
I was trying to follow this pattern for asynchronous processing http://jsonapi.org/recommendations/#asynchronous-processing
Glossing over some name changes, I'm basically trying to implement the part where a 303 is returned for GET /photos/queue-jobs/5234.
My reading of the spec allows for other status codes when fetching a resource, what do you think? http://jsonapi.org/format/#fetching-resources-responses-other
you are right, I looked at the code and this is a bug.
Theoretically you should be able to set a status code in the Responder, but in our FindOne method of the api, we always set a 200 which is not right. We have to change this.
Regardless of wether it is a bug or a feature, the next problem will be to implement the "see other" location header. But I'm working on it. If you can live without the self link which is handled in #99 it should be done soon. :-)
@tochiai I implemented most of the basics in #244 if you want you can test it. But its not yet possible to perfectly implement it.