softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.51k stars 194 forks source link

Support application/x-www-form-urlencoded Request Content Type #68

Closed slobo closed 8 years ago

slobo commented 8 years ago

Hi Adam, thanks for the great work.

Would it be possible for ElasticMQ 0.9+ to support request coming in as application/x-www-form-urlencoded? Perl module Amazon::SQS::Simple utilizes that, and it works fine on live SQS and 0.8.12, but falls over on emq 0.9.0 (probably something when moving from Spray to Akka?).

On calling CreateQueue: 400 Bad Request 
Invalid request: UnsupportedRequestContentTypeRejection(Set(application/x-www-form-urlencoded)); see the SQS docs.

Cheers

adamw commented 8 years ago

Sure - could you maybe provide a simple script which I could run locally to test? (manually) I'm not much of a python user :)

slobo commented 8 years ago

I've made a sample script (https://github.com/slobo/simple-sqs-test) that:

  1. Creates a queue
  2. Sends a message with POST
  3. Sends a message with GET

All of these work against Amazon, but 2. & 3. fail against 0.9 and 3. fails agains 0.8.12. (If it's any consolation, 3. fails against fake_sqs as well :) )

If you have docker installed then you can just run the following (substitute the last arg for your local running instance):

docker run -it --rm -e DEBUG=1 slobo/simple-sqs-request /src/sqs-request.pl http://192.1.2.34:6789

I apologize for the docker images size, if you prefer you can also run it against your system perl:

cpan Carton
git clone https://github.com/slobo/simple-sqs-test.git
cd simple-sqs-test/src
carton
carton exec -- ./sqs-request.pl http://192.1.2.34:6789
adamw commented 8 years ago

Can you try https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.9.1-SNAPSHOT.jar ?

slobo commented 8 years ago

Awesome, it works perfectly! Thanks for such a quick turnaround!

adamw commented 8 years ago

Great to hear, released as 0.9.1