Fixed body_parser analysis warnings
This commit is contained in:
parent
ef082cb000
commit
2d0082f3b0
4 changed files with 13 additions and 11 deletions
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 4.0.1
|
||||
|
||||
* Updated `belatuk_http_server` to 3.0.0
|
||||
|
||||
## 4.0.0
|
||||
|
||||
* Require Dart >= 2.17
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
name: belatuk_body_parser
|
||||
version: 4.0.0
|
||||
version: 4.0.1
|
||||
description: Parse request bodies and query strings in Dart. Supports JSON, URL-encoded, and multi-part bodies.
|
||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/body_parser
|
||||
environment:
|
||||
sdk: '>=2.17.0 <3.0.0'
|
||||
dependencies:
|
||||
http_parser: ^4.0.0
|
||||
belatuk_http_server: ^2.0.0
|
||||
belatuk_http_server: ^3.0.0
|
||||
mime: ^1.0.0
|
||||
dev_dependencies:
|
||||
http: ^0.13.0
|
||||
|
|
|
@ -63,9 +63,7 @@ world
|
|||
print('Response: ${response.body}');
|
||||
var jsons = json.decode(response.body);
|
||||
var files = jsons['files'].map((map) {
|
||||
return map == null
|
||||
? null
|
||||
: map.keys.fold<Map<String, dynamic>>(
|
||||
return map.keys.fold<Map<String, dynamic>>(
|
||||
<String, dynamic>{}, (out, k) => out..[k.toString()] = map[k]);
|
||||
});
|
||||
expect(files.length, equals(0));
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:http/http.dart' as http;
|
|||
import 'package:http_parser/http_parser.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
const TOKEN =
|
||||
const token =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiIxMjcuMC4wLjEiLCJleHAiOi0xLCJpYXQiOiIyMDE2LTEyLTIyVDEyOjQ5OjUwLjM2MTQ0NiIsImlzcyI6ImFuZ2VsX2F1dGgiLCJzdWIiOiIxMDY2OTQ4Mzk2MDIwMjg5ODM2NTYifQ==.PYw7yUb-cFWD7N0sSLztP7eeRvO44nu1J2OgDNyT060=';
|
||||
|
||||
String jsonEncodeBody(BodyParseResult result) {
|
||||
|
@ -89,12 +89,12 @@ void main() {
|
|||
});
|
||||
|
||||
test('JWT', () async {
|
||||
var postData = 'token=$TOKEN';
|
||||
var postData = 'token=$token';
|
||||
print('Body: $postData');
|
||||
var response = await client!.get(Uri.parse('$url/?$postData'));
|
||||
print('Response: ${response.body}');
|
||||
var query = json.decode(response.body)['query'];
|
||||
expect(query['token'], equals(TOKEN));
|
||||
expect(query['token'], equals(token));
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -129,11 +129,11 @@ void main() {
|
|||
});
|
||||
|
||||
test('JWT', () async {
|
||||
var postData = 'token=$TOKEN';
|
||||
var postData = 'token=$token';
|
||||
var response =
|
||||
await client!.post(Uri.parse(url!), headers: headers, body: postData);
|
||||
var body = json.decode(response.body)['body'];
|
||||
expect(body['token'], equals(TOKEN));
|
||||
expect(body['token'], equals(token));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue