Public bug reported: If you make a request to the compute api with an explicit type set in the 'Accept' header it will ignore it. Ideally what should happen in this case is that the server should response with a 406 <https://httpstatuses.com/406>.
(Examples run with devstack and nova master as of April 8, 2016) Here are two example one with an accept, one without: curl -v -H 'x-auth-token: e893759204ff41d49542b9d87520b03a' http://192.168.33.10:8774/v2.1/servers * Hostname was NOT found in DNS cache * Trying 192.168.33.10... * Connected to 192.168.33.10 (192.168.33.10) port 8774 (#0) > GET /v2.1/servers HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 192.168.33.10:8774 > Accept: */* > x-auth-token: e893759204ff41d49542b9d87520b03a > < HTTP/1.1 200 OK < Content-Length: 15 < Content-Type: application/json < X-Openstack-Nova-Api-Version: 2.1 < Vary: X-OpenStack-Nova-API-Version < X-Compute-Request-Id: req-09186938-8745-498a-9485-4773f29e510a < Date: Fri, 08 Apr 2016 14:27:24 GMT < * Connection #0 to host 192.168.33.10 left intact {"servers": []} curl -v -H 'x-auth-token: e893759204ff41d49542b9d87520b03a' -H 'accept: text/plain' http://192.168.33.10:8774/v2.1/servers * Hostname was NOT found in DNS cache * Trying 192.168.33.10... * Connected to 192.168.33.10 (192.168.33.10) port 8774 (#0) > GET /v2.1/servers HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 192.168.33.10:8774 > x-auth-token: e893759204ff41d49542b9d87520b03a > accept: text/plain > < HTTP/1.1 200 OK < Content-Length: 15 < Content-Type: application/json < X-Openstack-Nova-Api-Version: 2.1 < Vary: X-OpenStack-Nova-API-Version < X-Compute-Request-Id: req-6f5d003c-463e-4dae-b682-1091984e63ed < Date: Fri, 08 Apr 2016 14:28:32 GMT < * Connection #0 to host 192.168.33.10 left intact {"servers": []} Same response. Here's a gabbi failed test that may be a bit easier to read and demonstrats the expected result - name: try bad accept desc: why u no 406? xfail: True GET: /servers request_headers: accept: text/plain status: 406 This is related to the older https://bugs.launchpad.net/nova/+bug/724622 but this is a bit more specific. Now, obviously, this may not really be considered a bug, depending on how correct the api is supposed to be, but felt worth pointing it out. ** Affects: nova Importance: Undecided Status: New ** Tags: api -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1567966 Title: api does not handle explicit accept headers correctly Status in OpenStack Compute (nova): New Bug description: If you make a request to the compute api with an explicit type set in the 'Accept' header it will ignore it. Ideally what should happen in this case is that the server should response with a 406 <https://httpstatuses.com/406>. (Examples run with devstack and nova master as of April 8, 2016) Here are two example one with an accept, one without: curl -v -H 'x-auth-token: e893759204ff41d49542b9d87520b03a' http://192.168.33.10:8774/v2.1/servers * Hostname was NOT found in DNS cache * Trying 192.168.33.10... * Connected to 192.168.33.10 (192.168.33.10) port 8774 (#0) > GET /v2.1/servers HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 192.168.33.10:8774 > Accept: */* > x-auth-token: e893759204ff41d49542b9d87520b03a > < HTTP/1.1 200 OK < Content-Length: 15 < Content-Type: application/json < X-Openstack-Nova-Api-Version: 2.1 < Vary: X-OpenStack-Nova-API-Version < X-Compute-Request-Id: req-09186938-8745-498a-9485-4773f29e510a < Date: Fri, 08 Apr 2016 14:27:24 GMT < * Connection #0 to host 192.168.33.10 left intact {"servers": []} curl -v -H 'x-auth-token: e893759204ff41d49542b9d87520b03a' -H 'accept: text/plain' http://192.168.33.10:8774/v2.1/servers * Hostname was NOT found in DNS cache * Trying 192.168.33.10... * Connected to 192.168.33.10 (192.168.33.10) port 8774 (#0) > GET /v2.1/servers HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 192.168.33.10:8774 > x-auth-token: e893759204ff41d49542b9d87520b03a > accept: text/plain > < HTTP/1.1 200 OK < Content-Length: 15 < Content-Type: application/json < X-Openstack-Nova-Api-Version: 2.1 < Vary: X-OpenStack-Nova-API-Version < X-Compute-Request-Id: req-6f5d003c-463e-4dae-b682-1091984e63ed < Date: Fri, 08 Apr 2016 14:28:32 GMT < * Connection #0 to host 192.168.33.10 left intact {"servers": []} Same response. Here's a gabbi failed test that may be a bit easier to read and demonstrats the expected result - name: try bad accept desc: why u no 406? xfail: True GET: /servers request_headers: accept: text/plain status: 406 This is related to the older https://bugs.launchpad.net/nova/+bug/724622 but this is a bit more specific. Now, obviously, this may not really be considered a bug, depending on how correct the api is supposed to be, but felt worth pointing it out. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1567966/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

