belatuk_body_parser 6.0.0
belatuk_body_parser: ^6.0.0 copied to clipboard
Parse request bodies and query strings in Dart. Supports JSON, URL-encoded, and multi-part bodies.
Change Log #
6.0.0 #
Breaking changes in 6.0.0 #
- Breaking: Multipart text fields are no longer URL-decoded or split on
&and=, so+and%XXare kept as sent. In names and filenames, only the%22browsers send for"is decoded. - Breaking: Only UTF-8 and US-ASCII text is accepted. Any other declared charset, or bytes that are not valid for the charset, fail the parse with a
FormatException. Before, a multipart text field was decoded with its declared charset, and the charset of a JSON or URL-encoded body was ignored. - Breaking: Conflicting keys, such as
userwithuser.nameortagswithtags[], fail the parse with aFormatException. A repeated plain key still keeps the last value, and a JSON value counts as a plain value, soa={"x":1}witha.yis a conflict. - Breaking: A form or query key, or a multipart field name, that contains a control character, line break or bidi control fails the parse with a
FormatException, and so does a filename that contains a line break, a control character other than tab, or a bidi override. None of them can then inject a line break into a log or header, or display in a misleading order. A filename can still contain", so escape it before putting it in a quoted header value, and/,\and.., so clean it before using it as a path. Keys inside JSON are data and are not checked. - Breaking: A key with an empty segment, such as
a.ora..b, or with[]anywhere but once at the end, such asa[].bora[][], fails the parse with aFormatException. - Breaking: The query string is parsed for every request, and an error in it fails the request without parsing the body.
- Breaking: Only plain decimals that convert exactly become numbers, such as
42,-7or14.5. Values such as01234,+1555,1e3,0x1FandInfinitystay strings, as do integers too large for anintand decimals with more than 15 significant digits or outside the range of a double.-0and-0.0lose their sign. - Breaking: A dotted list key such as
user.tags[]is nested, givinguser: {tags: [...]}. - Breaking: A key without
=follows the same rules as other keys, so?opts.debuggivesopts: {debug: true}. - Breaking: A multipart text field without a
name, or with an empty one, is dropped. - Breaking: When the parse fails,
bodyandfilesare empty, andqueryis empty when the query string fails, instead of holding whatever was parsed before the error.
New in 6.0.0 #
- No longer depends on
belatuk_http_server.
Fixes in 6.0.0 #
- Multipart: A file input left blank, sent as an empty filename with no content, is not added to
files, and an empty filename with content falls back tofile. - Multipart: Uploaded files are stored byte for byte, and a file without a
Content-Typegetstext/plaininstead of failing the parse. - Multipart: A body cut off part-way, or one with a malformed part header, fails the parse instead of hanging forever.
- Multipart: A field value containing
&,=or%no longer adds fields or fails the parse. - URL-encoded: A stray
%or a raw non-ASCII character is kept instead of failing the parse. - URL-encoded: Empty pairs and pairs with no key, as in
/path?,a=1&&b=2&ora=1&=v, are skipped instead of stored under"". - Query: The query string is parsed even when the request has a body.
- JSON: A body that is not an object, such as
nullor[], fails with aFormatException. - Body: When a bad query string fails a JSON, URL-encoded or multipart request, or a multipart part is rejected, such as for a missing
Content-Dispositionor a bad charset, the rest of the body is still read, so it does not stall the connection. A multipart body that is broken, such as one with a bad boundary or a malformed part header, or one cut off part-way, stops the parse, and the rest of it is not read. - Values: Text that only looks like JSON, such as
[draft], stays a string instead of failing the parse.
5.6.0 #
- Require Dart >= 3.13
5.5.0 #
- Require Dart >= 3.8
5.4.1 #
- Updated
mimeto 2.0.0
5.4.0 #
- Require Dart >= 3.5
- Updated
lintsto 5.0.0
5.3.0 #
- Require Dart >= 3.3
- Updated
belatuk_http_serverto 4.4.0 - Updated
lintsto 4.0.0
5.2.0 #
- Updated
lintsto 3.0.0 - Updated
belatuk_http_serverto 4.2.0
5.1.0 #
- Updated
belatuk_http_serverto 4.1.1 - Updated
httpto 1.0.0
5.0.0 #
- Require Dart >= 3.0
5.0.0-beta.1 #
- Require Dart >= 3.0
- Updated
belatuk_http_serverto 4.0.0
4.0.1 #
- Updated
belatuk_http_serverto 3.0.0
4.0.0 #
- Require Dart >= 2.17
3.0.1 #
- Fixed boken license link
3.0.0 #
- Upgraded from
pendantictolintslinter - Published as
belatuk_body_parserpackage - Fixed linter warnings
2.1.1 #
- Fixed calling deprecated methods in unit test
2.1.0 #
- Replaced
http_serverwithbelatuk_http_server
2.0.1 #
- Fixed source code formating warning
- Updated README
2.0.0 #
- Migrated to support Dart SDK 2.12.x NNBD
1.1.1 #
- Dart 2 updates; should fix Angel in Travis.
1.1.0 #
- Add
parseBodyFromStream