PUT /v1/containers/<id> returns http 406, should be http 405
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Barbican |
Fix Released
|
Medium
|
Steve Heyman |
Bug Description
PUT to the /v1/containers/<id> resource returns http 406, which is what pecan sends when it finds that content types aren't as it expects.
Return code should be 405 in this case ("method not allowed").
This happens because the generic ('index') handler in the Containers controller is missing the template='json' option on the pecan expose decorator. This index function is where we return the (expected) 405 error. Without the template='json' option, the index function isn't called because pecan isn't happy with the content type (which we pass in as application/json). Pecan default is 'text/html'. Adding the decorator allows the call to go through to the index function, and the expected 405 is returned.
To resolve this problem:
1) add template='json' to the pecan expose decorator on the index function in the Containers controller
2) update the functionaltests
Changed in barbican: | |
importance: | Undecided → Medium |
assignee: | nobody → Steve Heyman (sheyman) |
status: | New → Confirmed |
Changed in barbican: | |
status: | Confirmed → In Progress |
description: | updated |
Changed in barbican: | |
milestone: | none → liberty-3 |
status: | Fix Committed → Fix Released |
Changed in barbican: | |
milestone: | liberty-3 → 1.0.0 |
Reviewed: https:/ /review. openstack. org/213402 /git.openstack. org/cgit/ openstack/ barbican/ commit/ ?id=663a2362bbe 56912e9f7f0451f cb9a37e8c387e8
Committed: https:/
Submitter: Jenkins
Branch: master
commit 663a2362bbe5691 2e9f7f0451fcb9a 37e8c387e8
Author: Steve Heyman <email address hidden>
Date: Fri Aug 14 21:13:31 2015 -0500
Ensure a http 405 is returned on container(s) PUT
Added the template='json' option to the pecan expose decorator on
the index function on the Containers controller to ensure that we
pass control to that function rather than have pecan determine
that some content type(s) aren't what it expects.
Without this fix, pecan looks at the content type (we set as /json) and since its not "text/html" pecan returns an
application
http 406 rather than passing control on to the index function which
sets the more appropriate http 405.
Closes-Bug #1485157
Change-Id: I4ff640c7bd412b 9946797d2da7be0 4fe78678c63