Closed ghost closed 1 year ago
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.
This issue was closed because it has been stalled for 30+7 days with no activity.
I needed to read the raw request body for one specific route. I tried to read
context.Request().Body
but it seemed like it was already read, even though I hadn't called context.Bind or anything. The request logs were showing it had indeed already been parsed as form-encoded (it was not, in fact, form encoded, and was sent without a content-type header).I found an old issue talking about this problem and comments suggest it was fixed by making the request body somehow able to be read multiple times. It sure doesn't seem fixed for me. Then I found another old issue suggesting that it had been un-fixed at some point, and the last comment suggests it's no longer acknowledged as a problem :/
I eventually solved this problem by sending
content-type: text/plain
on the request, so I'm making this issue for 2 purposes:to suggest this be more clearly documented.
to help people searching for this problem until then.
By the way, it's weird that this works because my app setup does
app.Use(contenttype.Set("application/json"))
, and the documentation forcontenttype.Set
says "This will override any content type sent by the client." Does contenttype.Set not work as intended?