https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29595 Bug ID: 29595 Summary: missing Content-Type / HTTP 415 check for POST requests to /api/v1/patrons Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: divinity76@gmail.com if you send a POST request to /api/v1/patrons with the header Content-Type: application/x-www-form-urlencoded which is a default header for curl and libcurl with POST requests, by the way, then Koha will try to parse it as a JSON, which leads to questions like this https://stackoverflow.com/questions/68106741/post-koha-patrons-to-koha-lms-u... and responses like this ``` { //Here is missing some code. "errors": [{ "message": "Missing property.", "path": "/body/address" }, { "message": "Missing property.", "path": "/body/category_id" }, { "message": "Missing property.", "path": "/body/city" }, { "message": "Missing property.", "path": "/body/library_id" }, { "message": "Missing property.", "path": "/body/surname" }], "status": 400 } ``` while HTTP 400 is a pretty good response, the correct response for unsupported Content-Type is actually
HTTP/1.1 415 Unsupported Media Type
and the error message could be something like { "errors": [{ "message": "request body must be application/json" }], ] -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.