goaws icon indicating copy to clipboard operation
goaws copied to clipboard

SNS Publish is content type json when body isnt json

Open rockliffelewis opened this issue 1 year ago • 1 comments

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.

rockliffelewis avatar Apr 25 '23 23:04 rockliffelewis

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

Admiral-Piett avatar Sep 28 '23 21:09 Admiral-Piett