Cannot specify Accept header for 204 response

Bug #1408378 reported by Sam Harwell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Poppy
Fix Released
Medium
Amit Gandhi

Bug Description

For certain calls which return a 204 No Content response, the Accept header cannot be set to application/json. Attempting to include such an Accept header results in a 406 Not Acceptable response. I believe each of these calls should allow the user to specify the Accept header for the following reasons.

1. The Accept header is used for content negotiation which affects not only the resource representation, but also the content type for error messages. For the affected calls, the 406 response actually contains the Content-Type: application/json header.

2. The 204 response indicates that the client does not need to update its existing view of the document (or resource) in question. The Accept applies to serialization/deserialization of resource data, so a response with no content is equivalent to supporting any Accept header.

3. From a usability standpoint while developing an SDK, this is especially problematic because it requires special handling be added for all affected calls to remove the default Accept header which is added by the framework. It is normal to override the header for special cases (e.g. for JSON Patch), but removing the header in preparation for a 204 is not anticipated.

RFC 7231 is not clear about the manner in which the Accept header "should" be evaluated for calls that return a 204 response. In the absence of a directive to implement the calls in a particular manner, the service should choose to do so in the manner most usable to clients. In this case, it means updating all calls which return no content (regardless of response code) to allow the Accept header to be specified as (at minimum) application/json, or possibly allow any syntactically correct value for this header.

Changed in poppy:
importance: Undecided → Medium
milestone: none → kilo-2
Revision history for this message
Amit Gandhi (amit-gandhi) wrote :

this affects the /ping endpoint

Changed in poppy:
assignee: nobody → Amit Gandhi (amit-gandhi)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to poppy (master)

Fix proposed to branch: master
Review: https://review.openstack.org/146221

Changed in poppy:
status: New → In Progress
Revision history for this message
Amit Gandhi (amit-gandhi) wrote :

this also affects the /services/serviceid/assets endpoint

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to poppy (master)

Reviewed: https://review.openstack.org/146221
Committed: https://git.openstack.org/cgit/stackforge/poppy/commit/?id=f9af92b7ad874991089332c7dea238f4d4914c53
Submitter: Jenkins
Branch: master

commit f9af92b7ad874991089332c7dea238f4d4914c53
Author: amitgandhinz <email address hidden>
Date: Fri Jan 9 18:01:58 2015 -0500

    User should be able to pass Accept: application/json header on 204

    Change-Id: Iaf83169d19cd1dbf63a044992139db85dd7d3da1
    Closes-Bug: 1408378

Changed in poppy:
status: In Progress → Fix Committed
Changed in poppy:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.