Opened 2 years ago

Closed 2 years ago

#3521 closed bug (Fixed)

Content-type's charset should be accepted and probably ignored for jsonrpc communication

Reported by: ibizaman Owned by:
Priority: minor Milestone: 2.1.0
Component: Web UI Version: 2.0.0
Keywords: Cc:

Description

Sending a request with 'Content-Type: application/json' works fine:

$ curl 'http://127.0.0.1:8112/json' -X POST \
       -H 'Content-Type: application/json' \
       --data-raw '{"method":"daemon.get_version","params":[],"id":1}'
{ "result": null
, "error": { "message": "Not authenticated"
           , "code": 1
           }
, "id": 1}

But it should work too with 'Content-Type: application/json;charset=utf-8' although it doesn't:

$ curl 'http://127.0.0.1:8112/json' -X POST \
       -H 'Content-Type: application/json;charset=utf-8' \
       --data-raw '{"method":"daemon.get_version","params":[],"id":1}'
{ "result": null
, "id": null
, "error": { "code": 5
           , "message": "JSONException: Invalid JSON request content-type: application/json;charset=utf-8"
           }
}

This is a valid content-type as per https://greenbytes.de/tech/webdav/rfc2616.html#header.content-type
I believe I know how to fix this and will create a PR for it.

Change History (1)

comment:1 by Calum, 2 years ago

Component: UnknownWeb UI
Milestone: needs verified2.1.0
Resolution: Fixed
Status: newclosed
Note: See TracTickets for help on using tickets.