400 response from samples api returns JSON response without content-type header

Bug #1426483 reported by Chris Dent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Undecided
Mehdi Abaakouk

Bug Description

If you make a request like this:

    - name: negative limit value
      url: /v2/samples?limit=-99

The response correctly has a 400 status code and the body of the body of the response is this:

    {"error_message": {"debuginfo": null, "faultcode": "Client", "faultstring": "Limit must be positive"}}

that's JSON, but there is no content-type header declaring the media-type of the body.

Revision history for this message
Chris Dent (cdent) wrote :

This is also the case for 404 responses.

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

I think this is a correct 400

and maybe this is a problem in wsme, otherwise all api should set their content-type

Revision history for this message
Chris Dent (cdent) wrote :

This is also true for /v2/meters/somemeter:

    - name: post meter error is JSON
      desc: https://bugs.launchpad.net/ceilometer/+bug/1426483
      xfail: true
      url: /v2/meters/apples
      method: POST
      request_headers:
          content-type: application/json
      data: ""
      status: 400
      response_headers:
          content-type: /application/json/
      response_json_paths:
          error_message:
              faulstring: 'Missing argument: "samples"'

The 400 response is correct, but there is no content-type header to indicate that the response is JSON and thus the response cannot be parsed as such.

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

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

Changed in ceilometer:
assignee: nobody → Mehdi Abaakouk (sileht)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/208455
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=76ec7420f86e5ec6ca9a5e11e4e2b7300bedd065
Submitter: Jenkins
Branch: master

commit 76ec7420f86e5ec6ca9a5e11e4e2b7300bedd065
Author: Mehdi Abaakouk <email address hidden>
Date: Mon Aug 3 14:13:07 2015 +0200

    Fix some gabbi tests

    Some asserts done by gabbi was failling due to:

      https://github.com/cdent/wsgi-intercept/pull/32

    Since the fix have been released the tests now pass.

    Closes-bug: #1426483
    Change-Id: I932707e59a6e3b4d753532456877b4d1383aa7c5

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: liberty-3 → 5.0.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.