Closed
Bug 1131057
Opened 9 years ago
Closed 8 years ago
base.api methods should send error messages that content type is invalid if they don't parse as JSON
Categories
(Taskcluster :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jhford, Unassigned)
Details
Attachments
(1 file)
Pete hit this today and it was the bane of my existence while writing the python client. Right now, the server only understands requests that are JSON and with the Content-type header set properly. That said, its error message for any exceptional case is to say that JSON Schema validation failed and list which keys are missing. When Pete was sending fully valid and well formed JSON data but missing the Content-type header. The error he was getting was a JSON-Schema validation error. I was sending the write header, but URL Encoded instead of JSON encoded. Given that (aiui) all endpoints only understand JSON input, we should: 1. if Content-type is not an understood one, we should error out with a message of "Content-type ${type} is not understood" 2. if the request body does not parse as the specified content-type, we should 400 with a message of "Body of type ${type} does not parse as such" This would be really helpful when hitting API endpoints or working on client libraries.
Comment 1•9 years ago
|
||
Agree... this sounds like a good idea. We should reply 400, if content-type isn't application/json and an input schema is defined.
Updated•9 years ago
|
Component: TaskCluster → General
Product: Testing → Taskcluster
Comment 2•8 years ago
|
||
Note, this is on top of the other PR...
Attachment #8693989 -
Flags: review?(jhford)
Reporter | ||
Updated•8 years ago
|
Attachment #8693989 -
Flags: review?(jhford) → review+
Comment 3•8 years ago
|
||
Landed... needs rolling out, but that is a slow process...
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•