Prepend '/' to the delete url for the v2 client
... and update tests to match. The missing slash results in a non-absolute DELETE request being sent to the API. E.g. DELETE v2/images/62fac489-23b4-4929-87af-2e7236e8542b HTTP/1.1 This is not strictly valid http/1.1 - rfc2616 specifies that the path must be absolute. This doesn't cause a problem for the API server, but this can cause problems if the API server is fronted by something else (see #133161). It also means that the curl command logged in debug mode has a bad url. E.g. curl -i -X DELETE ... http://10.0.0.13:9292v2/images/... Change-Id: Ib0c749dedbfcf07303fcddae4512db61b0f3fd78 Closes-bug: #1327101
This commit is contained in:
@@ -117,7 +117,7 @@ class Controller(object):
|
||||
|
||||
def delete(self, image_id):
|
||||
"""Delete an image."""
|
||||
self.http_client.json_request('DELETE', 'v2/images/%s' % image_id)
|
||||
self.http_client.json_request('DELETE', '/v2/images/%s' % image_id)
|
||||
|
||||
def create(self, **kwargs):
|
||||
"""Create an image."""
|
||||
|
@@ -118,7 +118,7 @@ fixtures = {
|
||||
},
|
||||
),
|
||||
},
|
||||
'v2/images/87b634c1-f893-33c9-28a9-e5673c99239a': {
|
||||
'/v2/images/87b634c1-f893-33c9-28a9-e5673c99239a': {
|
||||
'DELETE': (
|
||||
{},
|
||||
{
|
||||
@@ -496,7 +496,7 @@ class TestController(testtools.TestCase):
|
||||
self.controller.delete('87b634c1-f893-33c9-28a9-e5673c99239a')
|
||||
expect = [
|
||||
('DELETE',
|
||||
'v2/images/87b634c1-f893-33c9-28a9-e5673c99239a',
|
||||
'/v2/images/87b634c1-f893-33c9-28a9-e5673c99239a',
|
||||
{},
|
||||
None)]
|
||||
self.assertEqual(expect, self.api.calls)
|
||||
|
Reference in New Issue
Block a user