-
Notifications
You must be signed in to change notification settings - Fork 38.7k
doc: JSON-RPC request Content-Type is application/json #30215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Specify json content type in RPC examples
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
tdb3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK for 3c08e11
This is a reasonable change, which over time can help nudge implementations to usage of the more appropriate content-type application/json.
Spec tracing
I didn't see mention of content-type or linked RFC in the JSON-RPC v1 spec (https://www.jsonrpc.org/specification_v1), but the JSON-RPC 2.0 spec does reference RFC 4627 (https://www.ietf.org/rfc/rfc4627.txt), which specifies (in section 6) the type/subtype of application/json. RFC 4627 is obsoleted by 7159, which in turn is obsoleted by 8259, but the result is the same (section 12 of 8259 specifies usage of application/json).
nit: Technically, I think the trailing semicolon application/json; may be unnecessary, since there are no parameters specified with the content-type. https://www.rfc-editor.org/rfc/rfc2616#section-14.17, https://www.rfc-editor.org/rfc/rfc2616#section-3.7
Content-Type = "Content-Type" ":" media-type
media-type = type "/" subtype *( ";" parameter )
Other notes
While JSON-RPC 2.0 support was recently added (with backwards compatibility for pre-2.0) and the examples continue to specify "jsonrpc": "1.0", I think it's appropriate that this PR is scoped to updating just the content-type. Updating examples to use "jsonrpc": "2.0" would be best left to a later PR.
Sanity checking performed: viewed JSON-RPC-interface.md rendered in-browser, built and ran unit and functional tests (all passed, including rpc_tests), ran bitcoin-cli without the trailing semicolon to see how bitcoind would handle it (successful).
|
ACK 3c08e11
Good catch. Content type doesn't need to be suffixed with curl -H "X-First-Name: Joe" http://example.com/Also,
So it's never necessary to provide say |
|
29947 |
Specify json content type in RPC examples.
Picks up #29946. Which needed rebasing and the commit message fixing,