[rabbitmq-discuss] [RabbitMQ - HTTP API] Strange behaviour in the creation of a new binding

Salvatore Piccione salvo.picci at gmail.com
Wed May 4 14:22:24 BST 2011


Hello,

I'm working with RabbitMQ 2.4.1 for windows and I'm interacting with the
server through the HTTP Interface. I notice that I get a HTTP 400 result if
I try to create a binding and in the POST request body I don't indicate the
"arguments" key. The Management HTTP API specification states that for that
command all keys are optional; anyway the server creates the binding but the
HTTP Error message doesn't contain the "Location" header (where the URI of
your new binding should be reported).
Please, find below the messages I send to RabbitMQ and the replies I
receive.

1. Request body without "argument" key
REQUEST: POST /api/bindings/%2f/e/exchange1/q/queue1
REQUEST BODY: {"routing_key":"txtRoute"}
RESPONSE: HTTP/1.1 400 Bad Request
    Date: Wed, 04 May 2011 13:02:53 GMT
    Content-Length: 60
    Content-Type: application/json
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
RESPONSE BODY: {"error":"bad_request","reason":{"key_missing":"arguments"}}

2. Empty request body
REQUEST: POST /api/bindings/%2f/e/exchange1/q/queue1
REQUEST BODY: {}
RESPONSE: HTTP/1.1 400 Bad Request
    Date: Wed, 04 May 2011 13:09:53 GMT
    Content-Length: 88
    Content-Type: application/json
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
RESPONSE BODY:
{"error":"bad_request","reason":{"key_missing":"routing_key","key_missing":"arguments"}}


3. Request body with all keys
REQUEST: POST /api/bindings/%2f/e/exchange1/q/queue1
REQUEST BODY: {"arguments":[],"routing_key":"txtRoute"}
RESPONSE: HTTP/1.1 201 Created
    Date: Wed, 04 May 2011 13:00:29 GMT
    Content-Length: 0
    Location: ../../../../%2F/e/txtExchange/q/SubscriberHTTP1/txtRoute
    Content-Type: application/json
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)

Just to recap:
Case1: the binding is created with the given "routing_key" but no location
is returned
Case2: the binding is created but no location is returned
Case3: it works as expected

All above cases have been tested using a direct and a topic exchange.

Is there something wrong in my HTTP request or the HTTP API Specification
should be changed?

Regards,

Salvatore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110504/02801b87/attachment.htm>


More information about the rabbitmq-discuss mailing list