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

tests: Check Content-Type header returned from RPC server #7833

Merged
merged 1 commit into from Apr 18, 2016

Conversation

Projects
None yet
2 participants
@laanwj
Member

laanwj commented Apr 7, 2016

Check the Content-Type header that is returned from the RPC server. Only if it is application/json the data is supposed to be parsed as JSON.

This gives better reporting if the HTTP server happens to return an error that is not JSON-formatted, which is the case if it happens at a lower level before JSON-RPC kicks in.

Before: Unexpected exception caught during testing: No JSON object could be decoded

After: JSONRPC error: non-JSON HTTP response with '403 Forbidden' from server

@sipa

tests: Check Content-Type header returned from RPC server
Check the Content-Type header that is returned from the RPC server. Only
if it is `application/json` the data is supposed to be parsed as JSON.

This gives better reporting if the HTTP server happens to return an error that is
not JSON-formatted, which is the case if it happens at a lower level
before JSON-RPC kicks in.

Before: `Unexpected exception caught during testing: No JSON object could be decoded`

After: `JSONRPC error: non-JSON HTTP response with '403 Forbidden' from server`

@laanwj laanwj added the Tests label Apr 7, 2016

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Apr 15, 2016

Member

@MarcoFalke can you take a look here?

Member

laanwj commented Apr 15, 2016

@MarcoFalke can you take a look here?

@laanwj laanwj merged commit 5078ca4 into bitcoin:master Apr 18, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Apr 18, 2016

Merge #7833: tests: Check Content-Type header returned from RPC server
5078ca4 tests: Check Content-Type header returned from RPC server (Wladimir J. van der Laan)
@MarcoFalke

This comment has been minimized.

Show comment
Hide comment
@MarcoFalke

MarcoFalke Apr 18, 2016

Member

utACK 5078ca4

Sorry for taking so long, do you mind if this ends up upstream?

jgarzik/python-bitcoinrpc#65

Member

MarcoFalke commented Apr 18, 2016

utACK 5078ca4

Sorry for taking so long, do you mind if this ends up upstream?

jgarzik/python-bitcoinrpc#65

MarcoFalke added a commit to MarcoFalke/bitcoin that referenced this pull request Jun 9, 2016

nomnombtc added a commit to nomnombtc/bitcoin that referenced this pull request Nov 12, 2016

nomnombtc added a commit to nomnombtc/bitcoin that referenced this pull request Nov 12, 2016

nomnombtc added a commit to nomnombtc/bitcoin that referenced this pull request Nov 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment