Content-Type/Accept headers are no more specified in requests

Bug #1368335 reported by Cedric Brandily
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Cedric Brandily

Bug Description

Since keystone V3 auth support merge[1], neutronclient no more specifies Content-Type in requests with body:

  neutron --verbose net-create test
  ...

  DEBUG: keystoneclient.session REQ: curl -i -X POST http://pegsrt12.srv:9696/v2.0/networks.json -H "User-Agent: python- neutronclient" -H "X-Auth-Token: 19507007f4f043ab8e15e519282ade08" -d '{"network": {"name": "c-run", "admin_state_up": true}}'

Such request are invalid but succeed because neutron is able to deduce content-type from the url suffix .json.

[1]https://review.openstack.org/92390

Changed in python-neutronclient:
assignee: nobody → Cedric Brandily (cbrandily)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

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

Changed in python-neutronclient:
status: New → In Progress
Revision history for this message
Cedric Brandily (cbrandily) wrote :

Since keystone V3 auth support merge, neutronclient no more specifies Accept header.

summary: - Content-Type header is no more specified in requests with body
+ Content-Type/Accept headers are no more specified in requests
Kyle Mestery (mestery)
Changed in python-neutronclient:
milestone: none → 2.3.8
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/121014
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=fb83043e152e2181ed2431125bba32d89e3908b7
Submitter: Jenkins
Branch: master

commit fb83043e152e2181ed2431125bba32d89e3908b7
Author: Cedric Brandily <email address hidden>
Date: Thu Sep 11 21:14:18 2014 +0200

    Correct Content-Type/Accept management in HTTPClient/SessionClient

    Currently SessionClient.request never specifies Content-Type/Accept
    headers in requests where HTTPClient.request always specifies json
    Content-Type/Accept even with "--request-format xml" option ... requests
    succeed because neutron deduces Content-Type/Accept from url suffix when
    defined.

    This change ensures HTTPClient/SessionClient define Content-Type/Accept
    headers when needed and align them with --request-format option.

    Closes-Bug: #1368335
    Change-Id: I909e055e5e59fa5870a28ebb0f171812acca0745

Changed in python-neutronclient:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
status: Fix Committed → Fix Released
Revision history for this message
Randall Burt (randall-burt) wrote :

Because this only sets the default value for the map, the actual Accept and Content-type headers don't wind up getting sent. I think this bug should be re-opened.

Revision history for this message
Cedric Brandily (cbrandily) wrote :

According test_without_body and test_with_body[1], Accept and Content-Type (when needed) are sended.

Could you provide an example?

[1] https://github.com/openstack/python-neutronclient/blob/fb83043e152e2181ed2431125bba32d89e3908b7/neutronclient/tests/unit/test_http.py#L59-L65

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.