← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1674694] [NEW] In placement api error responses choose poor default content-type

 

Public bug reported:


Because the placement api (up to at least version 1.5) uses webob exceptions and response objects without much modification, when an error response is created it will have a content-type based on any guidance provided in an accept header. If no accept header is present then a textual default (either HTML or text/plain, can't remember right now and it is not relevant) is used.

For a web app that is served through the browser this is a reasonable
default, but since the placement api is primarily a JSON-based thing, it
would be better to have application/json as the default error format
(while still allowing the accept header to be respected).

Now that we are using the wsgi_wrapper.PlacementWsgify decorator on all
our handlers, there is now an easy place to make this happen by checking
the req for an accept header and if it is not there setting it to
application/json for the error response.

Care will need to taken to make sure that any error message that wants
to use the value of accept isn't compromised.

** Affects: nova
     Importance: Low
         Status: Triaged


** Tags: placement

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1674694

Title:
  In placement api error responses choose poor default content-type

Status in OpenStack Compute (nova):
  Triaged

Bug description:
  
  Because the placement api (up to at least version 1.5) uses webob exceptions and response objects without much modification, when an error response is created it will have a content-type based on any guidance provided in an accept header. If no accept header is present then a textual default (either HTML or text/plain, can't remember right now and it is not relevant) is used.

  For a web app that is served through the browser this is a reasonable
  default, but since the placement api is primarily a JSON-based thing,
  it would be better to have application/json as the default error
  format (while still allowing the accept header to be respected).

  Now that we are using the wsgi_wrapper.PlacementWsgify decorator on
  all our handlers, there is now an easy place to make this happen by
  checking the req for an accept header and if it is not there setting
  it to application/json for the error response.

  Care will need to taken to make sure that any error message that wants
  to use the value of accept isn't compromised.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1674694/+subscriptions


Follow ups