Skip to content

Possibility to specify HTTP Status Code has been added #8

Closed
wants to merge 9 commits into from

3 participants

@vkamensky

I've added possibility to specify http status code. According to specification http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ResponseStatusCodes status code may be changed to 500, 301 etc. Status code may be passed with "http_status_code" value passed into response info obj.

@tonyg
Owner
tonyg commented on 9fb4543 Oct 17, 2011

Why do you want this change? Wouldn't it be just as easy to pass in [] where required instead of undefined?

This 'undefined' is provided by rfc4627_jsonrpc_http:parse_jsonrpc/5 when no params are specified in POST request:
https://github.com/mrspark/erlang-rfc4627/blob/9fb45432f9bc274690694f0a6933e354b3545955/src/rfc4627_jsonrpc_http.erl#L151
We may fix it there then.

Owner

Hmm, interesting. Reading the 1.1 JSON-RPC spec, it's hard to know what to do. So first off, I think you're right to fix it in rfc4627_jsonrpc_http:parse_jsonrpc/5, but the question then becomes: what should be done? My guess is that absent parameters should be treated like [], exactly as you suggested in this commit. The spec says that params is optional, but then says that if it has a value other than an array or object, the server must reject the request with an error, which seems a bit contradictory.

Let's then support parameterless invocations. Fixed in mrspark/erlang-rfc4627@0080fdd

Owner
tonyg replied Nov 1, 2011

Thanks! Applied.

@tonyg
Owner
tonyg commented May 15, 2012

Hi - I like the idea of this patch, but I'm having trouble seeing the patch history cleanly. Could I get you to (a) rebase your master off tonyg/master, and then (b) open a fresh pull request? This one has a long and confusing history that is best dropped at this point, IMO.

@tonyg tonyg closed this May 15, 2012
@vkamensky

Hi,

I am newbie in git so could you please provide me instructions how to do this :)

@tonyg
Owner
tonyg commented May 15, 2012
@vkamensky

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.