A 405 error should be returned when invoking a heat API with an unsupported request method

Bug #1367057 reported by Miguel Grinberg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Miguel Grinberg

Bug Description

The heat API returns a 404 Not Found error when sending a request to a valid URL but with an unsupported request method.

Example (using httpie from the command line):

$ http GET http://192.168.33.10:8004/v1/14d6f71c653d4ba5ad4a2320411a0ea8/validate template="heat_template_version: 2013-05-23" X-Auth-Token:XXXXX
HTTP/1.1 404 Not Found
Content-Length: 52
Content-Type: text/plain; charset=UTF-8
Date: Tue, 09 Sep 2014 01:11:52 GMT
X-Openstack-Request-Id: req-81f6cb8e-4963-47aa-b3fb-22de0197e9bd

404 Not Found

The resource could not be found.

$ http POST http://192.168.33.10:8004/v1/14d6f71c653d4ba5ad4a2320411a0ea8/validate template="heat_template_version: 2013-05-23" X-Auth-Token:XXXXX
HTTP/1.1 200 OK
Content-Length: 51
Content-Type: application/json; charset=UTF-8
Date: Tue, 09 Sep 2014 01:13:12 GMT
X-Openstack-Request-Id: req-a93356b4-e8b4-45c3-8387-bce9ec1817d1

{
    "Description": "No description",
    "Parameters": {}
}

Changed in heat:
status: New → Triaged
importance: Undecided → Medium
Changed in heat:
assignee: nobody → Miguel Grinberg (miguelgrinberg)
Revision history for this message
Sirushti Murugesan (sirushtim) wrote :

This change could possibly help with the implementation bit btw. https://review.openstack.org/#/c/103959/ Cheers.

Revision history for this message
Miguel Grinberg (miguelgrinberg) wrote :

Thanks. Interesting choice of implementation. I wonder why they decided to explicitly create all the routes to unsupported methods, it's pretty easy to define those automatically.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: Triaged → In Progress
Changed in heat:
milestone: none → kilo-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/120914
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=8a2e0aff98b54f73773fb2e35770e1c35ec460a9
Submitter: Jenkins
Branch: master

commit 8a2e0aff98b54f73773fb2e35770e1c35ec460a9
Author: Miguel Grinberg <email address hidden>
Date: Thu Sep 11 03:47:54 2014 +0000

    proper handling of unsupported request methods

    This change adds support for responding to unsupported methods for all
    routes. Invoking a route with an unsupported request method returns a 405
    status code, and the response includes the 'Allow' header listing the
    request methods supported by the requested URL. The OPTIONS request method
    is also automatically supported for all URLs, with the response
    returning the 'Allow' header. The way routes are registered has been
    changed so that unsupported methods can be detected automatically.

    Change-Id: I2de28e0fc6cd35ed060395405aa3770b1dc73376
    Closes-Bug: 1367057
    APIImpact
    DocImpact

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: kilo-2 → 2015.1.0
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.