Skip to content

Commit 12c3cb9

Browse files
committed
2 parents 147dbcb + b9d5c63 commit 12c3cb9

File tree

5 files changed

+48
-16
lines changed

5 files changed

+48
-16
lines changed

.all-contributorsrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@
102102
"contributions": [
103103
"ideas"
104104
]
105+
},
106+
{
107+
"login": "meysammahfouzi",
108+
"name": "Meysam",
109+
"avatar_url": "https://avatars.githubusercontent.com/u/14848008?v=4",
110+
"profile": "https://github.com/meysammahfouzi",
111+
"contributions": [
112+
"doc"
113+
]
114+
},
115+
{
116+
"login": "Mawi137",
117+
"name": "Martijn",
118+
"avatar_url": "https://avatars.githubusercontent.com/u/5464100?v=4",
119+
"profile": "https://github.com/Mawi137",
120+
"contributions": [
121+
"test",
122+
"code"
123+
]
105124
}
106125
],
107126
"contributorsPerLine": 7,

CHANGELOG.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
# Changelog
22

3-
## Unreleased
4-
5-
-  Added: Response Transformation (useful for background json decoding/encoding).
6-
-  Added: Support for streamed requests and `send` method.
7-
-  Changed: 80% code coverage.
8-
93
## 1.0.0
104

5+
Check out the [1.0.0 migration guide](./guides/migration_guide_1.0.0.md) for information on how to migrate your code.
6+
117
- ❗️🛠  Changed: Renamed `HttpClientWithInterceptor` to `InterceptedClient`.
128
- ❗️🛠  Changed: Renamed `HttpWithInterceptor` to `InterceptedHttp`.
139
- ❗️🛠  Removed: `badCertificateCallback` from `InterceptedClient` and `InterceptedHttp` in order to fully support Flutter Web 🌐 . In order to use refer to the migration guide.
1410
-  Added: Array parameters on `RequestData` following a similar principle than `http`'s `queryParametersAll` .
1511
-  Changed: `ResponseData` now has `bodyBytes` to allow encoding or decoding in the format desired.
1612
-  Changed: Migrated tests to use `test` package instead of `flutter_test`.
17-
-  Changed: Package no longer depends on Flutter, which means that it can be used with standalone Dart projects.
1813
-  Changed: More tests and coverage, this is a work in progress.
19-
20-
Check out the [1.0.0 migration guide](./guides/migration_guide_1.0.0.md) for information on how to migrate your code.
14+
- 🗑  Removed: Package no longer depends on Flutter, which means that it can be used with standalone Dart projects.
2115

2216
## 0.4.1
2317

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
[![Pub](https://img.shields.io/pub/v/http_interceptor.svg)](https://pub.dev/packages/http_interceptor)
44
[![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart)
55
[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)
6-
[![codecov](https://codecov.io/gh/CodingAleCR/http_interceptor/branch/master/graph/badge.svg)](https://codecov.io/gh/CodingAleCR/http_interceptor)
6+
[![codecov](https://codecov.io/gh/CodingAleCR/http_interceptor/branch/main/graph/badge.svg?token=hgsnPctaDz)](https://codecov.io/gh/CodingAleCR/http_interceptor)
77
[![Star on GitHub](https://img.shields.io/github/stars/codingalecr/http_interceptor.svg?style=flat&logo=github&colorB=deeppink&label=stars)](https://github.com/codingalecr/http_interceptor)
88

99
<!-- prettier-ignore-start -->
1010
<!-- markdownlint-disable -->
1111
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
12-
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
12+
[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-)
1313
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1414
<!-- markdownlint-restore -->
1515
<!-- prettier-ignore-end -->
@@ -65,13 +65,13 @@ In order to implement `http_interceptor` you need to implement the `InterceptorC
6565
```dart
6666
class LoggingInterceptor implements InterceptorContract {
6767
@override
68-
Future<RequestData> interceptRequest({RequestData data}) async {
68+
Future<RequestData> interceptRequest({required RequestData data}) async {
6969
print(data.toString());
7070
return data;
7171
}
7272
7373
@override
74-
Future<ResponseData> interceptResponse({ResponseData data}) async {
74+
Future<ResponseData> interceptResponse({required ResponseData data}) async {
7575
print(data.toString());
7676
return data;
7777
}
@@ -84,7 +84,7 @@ class LoggingInterceptor implements InterceptorContract {
8484
```dart
8585
class WeatherApiInterceptor implements InterceptorContract {
8686
@override
87-
Future<RequestData> interceptRequest({RequestData data}) async {
87+
Future<RequestData> interceptRequest({required RequestData data}) async {
8888
try {
8989
data.params['appid'] = OPEN_WEATHER_API_KEY;
9090
data.params['units'] = 'metric';
@@ -96,7 +96,7 @@ class WeatherApiInterceptor implements InterceptorContract {
9696
}
9797
9898
@override
99-
Future<ResponseData> interceptResponse({ResponseData data}) async => data;
99+
Future<ResponseData> interceptResponse({required ResponseData data}) async => data;
100100
}
101101
```
102102

@@ -265,6 +265,8 @@ Thanks to all the wonderful people contributing to improve this package. Check t
265265
<tr>
266266
<td align="center"><a href="https://github.com/shyndman"><img src="https://avatars.githubusercontent.com/u/42326?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Scott Hyndman</b></sub></a><br /><a href="#ideas-shyndman" title="Ideas, Planning, & Feedback">🤔</a></td>
267267
<td align="center"><a href="https://github.com/II11II"><img src="https://avatars.githubusercontent.com/u/45257709?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Islam Akhrarov</b></sub></a><br /><a href="#ideas-II11II" title="Ideas, Planning, & Feedback">🤔</a></td>
268+
<td align="center"><a href="https://github.com/meysammahfouzi"><img src="https://avatars.githubusercontent.com/u/14848008?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Meysam</b></sub></a><br /><a href="https://github.com/CodingAleCR/http_interceptor/commits?author=meysammahfouzi" title="Documentation">📖</a></td>
269+
<td align="center"><a href="https://github.com/Mawi137"><img src="https://avatars.githubusercontent.com/u/5464100?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Martijn</b></sub></a><br /><a href="https://github.com/CodingAleCR/http_interceptor/commits?author=Mawi137" title="Tests">⚠️</a> <a href="https://github.com/CodingAleCR/http_interceptor/commits?author=Mawi137" title="Code">💻</a></td>
268270
</tr>
269271
</table>
270272

lib/models/request_data.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RequestData {
2727

2828
factory RequestData.fromHttpRequest(Request request) {
2929
var params = Map<String, dynamic>();
30-
request.url.queryParameters.forEach((key, value) {
30+
request.url.queryParametersAll.forEach((key, value) {
3131
params[key] = value;
3232
});
3333
String baseUrl = request.url.origin + request.url.path;

test/models/request_data_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ main() {
6767
equals(
6868
"https://www.google.com/helloworld?key=123ABC&name=Hugo&type=3"));
6969
});
70+
test("can be instantiated from HTTP GET Request with multiple parameters with same key", () {
71+
// Arrange
72+
Uri url = Uri.parse(
73+
"https://www.google.com/helloworld?name=Hugo&type=2&type=3&type=4");
74+
75+
Request request = Request("GET", url);
76+
RequestData requestData;
77+
78+
// Act
79+
requestData = RequestData.fromHttpRequest(request);
80+
81+
// Assert
82+
expect(
83+
requestData.url,
84+
equals(
85+
"https://www.google.com/helloworld?name=Hugo&type=2&type=3&type=4"));
86+
});
7087
test("correctly creates the request URL string", () {
7188
// Arrange
7289
Uri url = Uri.parse(

0 commit comments

Comments
 (0)