-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
577 additions
and
361 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 3.0.9 2020.2.24 | ||
|
||
- Add test cases | ||
|
||
# 3.0.8 2019.12.29 | ||
|
||
- Code style improvement | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
name: dio | ||
description: A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc. | ||
version: 3.0.8 | ||
version: 3.0.9 | ||
homepage: https://github.com/flutterchina/dio | ||
author: wendux <[email protected]> | ||
|
||
environment: | ||
sdk: '>2.4.0 <3.0.0' | ||
|
@@ -13,6 +12,5 @@ dependencies: | |
|
||
dev_dependencies: | ||
test: ^1.5.1 | ||
test_coverage: ^0.2.0 | ||
pedantic: '1.1.0' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
----dio-boundary-3788753558 | ||
content-disposition: form-data; name="name" | ||
|
||
wendux | ||
----dio-boundary-3788753558 | ||
content-disposition: form-data; name="age" | ||
|
||
25 | ||
----dio-boundary-3788753558 | ||
content-disposition: form-data; name="file" | ||
content-type: text/plain; charset=utf-8 | ||
|
||
hellow world. | ||
----dio-boundary-3788753558 | ||
content-disposition: form-data; name="files[]"; filename="1.txt" | ||
content-type: application/octet-stream | ||
|
||
你好世界, | ||
我很好人类 | ||
哈哈哈哈哈😆 | ||
|
||
----dio-boundary-3788753558 | ||
content-disposition: form-data; name="files[]"; filename="2.txt" | ||
content-type: application/octet-stream | ||
|
||
你好世界, | ||
我很好人类 | ||
哈哈哈哈哈😆 | ||
|
||
----dio-boundary-3788753558-- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
你好世界, | ||
我很好人类 | ||
哈哈哈哈哈😆 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
@TestOn('vm') | ||
|
||
import 'dart:async'; | ||
import 'dart:io'; | ||
import 'package:dio/dio.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('#send with an invalid URL', () { | ||
expect(Dio().get('http://http.invalid').catchError((e) => throw e.error), | ||
throwsA(const TypeMatcher<SocketException>())); | ||
}); | ||
test('#cancellation', () async { | ||
var dio = Dio(); | ||
CancelToken token = CancelToken(); | ||
Timer(Duration(milliseconds: 10), () { | ||
token.cancel('cancelled'); | ||
}); | ||
|
||
var url = 'https://accounts.google.com'; | ||
expect( | ||
dio | ||
.get(url, cancelToken: token) | ||
.catchError((e) => throw CancelToken.isCancel(e)), | ||
throwsA(isTrue)); | ||
}); | ||
|
||
|
||
test('#url encode ', () { | ||
var data = { | ||
'a': '你好', | ||
'b': [5, '6'], | ||
'c': { | ||
'd': 8, | ||
'e': { | ||
'a': 5, | ||
'b': [66, 8] | ||
} | ||
} | ||
}; | ||
var result = | ||
'a=%E4%BD%A0%E5%A5%BD&b%5B%5D=5&b%5B%5D=6&c%5Bd%5D=8&c%5Be%5D%5Ba%5D=5&c%5Be%5D%5Bb%5D%5B%5D=66&c%5Be%5D%5Bb%5D%5B%5D=8'; | ||
expect(Transformer.urlEncodeMap(data), result); | ||
}); | ||
} |
Oops, something went wrong.