Tempest rest clients does not send the accept header for GET and DELETE

Bug #1215886 reported by Andrea Frittoli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Invalid
Undecided
Unassigned

Bug Description

Tempest rest client and all clients which rely on it do not send the accept header for GET and DELETE.

The header is aggregated to the content-type one, so it is sent only when the content-type one is needed, which is in case of POST and PUT only.

In case of rate limiting for instance, the returned content-type will be the wrong one for XML (assuming that JSON is the default returned when the header is not specified).

summary: - Tempest rest clients does not send the accept header in cases
+ Tempest rest clients does not send the accept header for GET and DELETE
Changed in tempest:
status: New → Invalid
status: Invalid → New
Sean Dague (sdague)
Changed in tempest:
importance: Undecided → Low
tags: added: low-hanging-fruit
Changed in tempest:
status: New → Confirmed
Revision history for this message
Mauro S M Rodrigues (maurorodrigues) wrote :

tempest.services.compute.xml.servers_client.ServersClientXML does use Accept header, debuging list_servers I can see:

> /opt/stack/tempest/tempest/services/compute/xml/servers_client.py(239)list_servers()
    238
--> 239 resp, body = self.get(url, self.headers)
    240 servers = self._parse_array(etree.fromstring(body))

pdb> self.headers
{'Content-Type': 'application/xml', 'Accept': 'application/xml', 'X-Auth-Token': <ommiting>}

and the response:

> /opt/stack/tempest/tempest/services/compute/xml/servers_client.py(240)list_servers()
    239 resp, body = self.get(url, self.headers)
--> 240 servers = self._parse_array(etree.fromstring(body))
    241 return resp, {"servers": servers}
ipdb> resp
{'status': '200', 'content-length': '515', 'content-location': u'http://9.114.111.27:8774/v2/5ec615f57dcb4419ad5a0f3ff570a6cc/servers', 'x-compute-request-id': 'req-01e2c636-a791-4036-ba58-46be4f34b9ed', 'connection': 'close', 'date': 'Thu, 12 Dec 2013 14:04:53 GMT', 'content-type': 'application/xml'}
ipdb> body
'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"><server name="server-tempest-1339459178" id="9f72e9c3-2547-42e3-8504-5c76d7ba7c4e"><atom:link href="http://9.114.111.27:8774/v2/5ec615f57dcb4419ad5a0f3ff570a6cc/servers/9f72e9c3-2547-42e3-8504-5c76d7ba7c4e" rel="self"/><atom:link href="http://9.114.111.27:8774/5ec615f57dcb4419ad5a0f3ff570a6cc/servers/9f72e9c3-2547-42e3-8504-5c76d7ba7c4e" rel="bookmark"/></server></servers>'

came in xml as expected.

Changed in tempest:
status: Confirmed → Invalid
importance: Low → Undecided
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.