Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
767 stars 144 forks source link

SNS Publish is content type json when body isnt json #262

Open rockliffelewis opened 1 year ago

rockliffelewis commented 1 year ago

I've got an SNS topic publishing to a HTTP endpoint, and the response its giving me has header Content-Type: application/json but the body isnt valid JSON.

The AWS documentation states that the header should be text/plain: https://docs.aws.amazon.com/sns/latest/dg/sns-message-and-json-formats.html

Changing this to suit would fix my issue at least: https://github.com/Admiral-Piett/goaws/blob/bc027e4ec99c700f0935c75c9a57f6cc21157cb2/app/gosns/gosns.go#L642

Currently its difficult to process the request using nodejs express, as the body parsers use that content type to decide how to parse the body, and the bodys json content is formatted a bit weirdly.

Admiral-Piett commented 9 months ago

Good catch! I'll have a look at this as soon as I can.