← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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.

** Affects: glance
     Importance: Undecided
         Status: New

-- 
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):
  New

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


Follow ups

References