This commit is contained in:
thosakwe 2017-03-07 16:29:18 -05:00
parent b70b881e85
commit 2f7663abd2
3 changed files with 9 additions and 7 deletions

View file

@ -1,5 +1,5 @@
# Body Parser # Body Parser
![version 1.0.0](https://img.shields.io/badge/version-1.0.0-brightgreen.svg) ![version 1.0.01(https://img.shields.io/badge/version-1.0.1-brightgreen.svg)
![build status](https://travis-ci.org/thosakwe/body_parser.svg) ![build status](https://travis-ci.org/thosakwe/body_parser.svg)
Parse request bodies and query strings in Dart, as well multipart/form-data uploads. No external Parse request bodies and query strings in Dart, as well multipart/form-data uploads. No external

View file

@ -10,7 +10,8 @@ buildMapFromUri(Map map, String body) {
if (keyValuePair.contains('=')) { if (keyValuePair.contains('=')) {
var equals = keyValuePair.indexOf('='); var equals = keyValuePair.indexOf('=');
String key = Uri.decodeQueryComponent(keyValuePair.substring(0, equals)); String key = Uri.decodeQueryComponent(keyValuePair.substring(0, equals));
String value = keyValuePair.substring(equals + 1); //Uri.decodeQueryComponent(split[1]); String value =
Uri.decodeQueryComponent(keyValuePair.substring(equals + 1));
if (parseArrayRgx.hasMatch(key)) { if (parseArrayRgx.hasMatch(key)) {
Match queryMatch = parseArrayRgx.firstMatch(key); Match queryMatch = parseArrayRgx.firstMatch(key);
@ -34,8 +35,9 @@ buildMapFromUri(Map map, String body) {
targetMap[keys[i]] = getValue(value); targetMap[keys[i]] = getValue(value);
} }
} }
} } else
else map[key] = getValue(value); map[key] = getValue(value);
} else map[Uri.decodeQueryComponent(keyValuePair)] = true; } else
map[Uri.decodeQueryComponent(keyValuePair)] = true;
} }
} }

View file

@ -1,6 +1,6 @@
name: body_parser name: body_parser
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
version: 1.0.0 version: 1.0.1
description: Parse request bodies and query strings in Dart. description: Parse request bodies and query strings in Dart.
homepage: https://github.com/thosakwe/body_parser homepage: https://github.com/thosakwe/body_parser
dependencies: dependencies: