-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse form-urlencoded, form-data body parameters
Specifically, parseApiRequest now parses the bodies of POST requests with a Content-Type of either application/x-www-form-urlencoded or multipart/form-data. This is to support to primary use cases: 1. The typical /subscribe submission from a web form, which defaults to form-urlencoded, but can easily use form-data. It would require JavaScript to construct path parameters instead, or even a JSON payload. 2. The List-Unsubscribe=One-Click use case. The email address and UID are path parameters, but the List-Unsubscribe parameter must encoded in the body. See: https://www.rfc-editor.org/rfc/rfc8058 Performed slight refactoring and cleanup of parser.go and parser_test.go along the way. Of particular note is that parseApiRequest wraps all errors in ParseError, instead of having ParseErrors bubble up.
- Loading branch information
Showing
2 changed files
with
319 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.