← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1268505] Re: The response is text/plain format when encouter exception, even though set "Accept:application/json"

 

Unfortunately there is no way to change this behavior without breaking
backwards compatibility for clients that are sending Accept headers but
already parsing text/plain responses on errors. So we cannot fix it.

** Changed in: glance
       Status: In Progress => Won't Fix

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1268505

Title:
  The response is text/plain format when encouter exception, even though
  set "Accept:application/json"

Status in OpenStack Image Registry and Delivery Service (Glance):
  Won't Fix

Bug description:
  when the request encounter the exception, the response will be text/plain, even though I specify "Accept:application/json" in the request header.
  This is a different behavior from glance with other projects.

  I deploy  the havana version, and use the glance api v2 as follows:

  curl -i -X PATCH -H "X-Auth-Token: $token" -H "content-type:application/openstack-images-v2.0-json-patch" -H 'Accept:application/json' \
  -d '[{"replace": "/size", "value": 1}]' \
  http://192.168.0.100:9292/v2/images/$1

  The response like this.

  HTTP/1.1 403 Forbidden
  Content-Length: 50
  Content-Type: text/plain; charset=UTF-8
  X-Openstack-Request-Id: req-2ceb2641-93af-416c-a846-f24b8b33657c
  Date: Mon, 13 Jan 2014 08:13:23 GMT

  403 Forbidden

  Attribute 'size' is read-only.

  I expect like this

  HTTP/1.1 403 Forbidden
  Content-Length: 50
  Content-Type: text/json; charset=UTF-8
  X-Openstack-Request-Id: req-2ceb2641-93af-416c-a846-f24b8b33657c
  Date: Mon, 13 Jan 2014 08:13:23 GMT
  {"Fobidden": {"message": "Attribute 'size' is read-only.", "code": 403}}

  
  I think the glance need the wsgi middleware to process the exception message like nova and cinder project.

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


References