Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Parsing x-www-form-urlencoded POST Requests #50

Open
antsankov opened this issue Jun 29, 2015 · 1 comment
Open

Issue Parsing x-www-form-urlencoded POST Requests #50

antsankov opened this issue Jun 29, 2015 · 1 comment

Comments

@antsankov
Copy link

I was working on an endpoint that needed to receive requests in the format x-www-form-urlencoded. This causes issues with the JSON decoder line in handler.go:

data, err := decodePayload(payloadString(r.Body))
        if err != nil {
            // Payload decoding failed.
            ctx = ctx.setError(BadRequest(err.Error()))
        }

Obviously if the data isn't in JSON format it can't be decoded. However if you even attempt to decode r.Body, because it is a io stream, it is emptied and can't be accessed.

I devised a way of fixing this in my project, and was curious if there was any interest in a pull request for this issue.

@tylertreat-wf
Copy link
Contributor

Yeah, ideally payload decoding could be pluggable based on the Content-Type. Feel free to open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants