[issue2551289] Invalid REST Accept header with post/put performs change before returning 406.

John Rouillard <[email protected]> Wed, 02 Aug 2023 21:58:25 +0000
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from John Rouillard:

Sending a POST, PUT (maybe PATCH) with an accept header that is not
application/json or xml (if enabled) will complete the request before throwing
a 406 error.

This is incorrect. The Accept header should be validated first and a 406 returned
before any change/work is done.

Note that the property binary_content should allow a value other than json and xml.
In this case, the Accept value must match the mime type of the file content (as reported in 
the file metadata at data/file/N data.attributes.type). The response will be the raw binary
file with the Content-Type set to the mime type and the content-length the length of the
binary content.

This also applies to a GET, but a GET is read only so less of an issue.

This is a prereq for issue 2551068.

----------
components: API
messages: 7822
nosy: rouilj
severity: normal
status: new
title: Invalid REST Accept header with post/put performs change before returning 406.
type: behavior

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551289>
_________________________________________________