Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve DioErrors #1405

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
96e1ef0
Fix BrowserHttpClientAdapter canceled hangs
morlay Jan 19, 2022
95c004e
Revert "It's safe for status code to be non-null"
ueman Jan 26, 2022
cbf8c8f
Merge pull request #1404 from ueman/revert-non-null-status-code
kuhnroyal Jan 26, 2022
283bb35
improve inner stacktraces
ueman Jan 26, 2022
271eebd
docs: fix table of contents links
Ascenio Jan 27, 2022
0e11a48
Improve DioError
ueman Jan 27, 2022
c61c8eb
improve error
ueman Jan 27, 2022
4beed0b
wip
ueman Jan 28, 2022
c17462e
wip
ueman Jan 30, 2022
1df2d46
code improvement
ueman Jan 30, 2022
2637269
fix tests
ueman Jan 30, 2022
1853a30
better code flow
ueman Jan 30, 2022
6588021
only print stacktrace if not duplicated
ueman Jan 30, 2022
fbee370
ci: Remove dev channel, now always points to beta
kuhnroyal Feb 4, 2022
0e6753c
Merge pull request #1411 from kuhnroyal/feature/remove-dev-channel
kuhnroyal Feb 4, 2022
1053fb6
Merge pull request #1406 from Ascenio/patch-2
kuhnroyal Feb 4, 2022
39d6f83
ci: Upload and collect test results for all sdks
kuhnroyal Feb 5, 2022
349ba31
Merge pull request #1412 from kuhnroyal/ci/split-test-results
kuhnroyal Feb 5, 2022
4df73f6
Merge branch 'develop' into morley-deveop
kuhnroyal Feb 5, 2022
0a7b891
Add changelog and update workflow
kuhnroyal Feb 5, 2022
b4bb6ff
Merge pull request #1389 from morlay/develop
kuhnroyal Feb 5, 2022
2872c10
ci: Run checkout in test reporter workflow
kuhnroyal Feb 5, 2022
bfc4892
Merge pull request #1413 from kuhnroyal/ci/checkout-in-test-reporter
kuhnroyal Feb 5, 2022
1975121
Bump subosito/flutter-action from 2.2.1 to 2.3.0
dependabot[bot] Feb 8, 2022
3b1d276
Fix links in README docs
yfdyh000 Feb 9, 2022
2242d1f
Merge pull request #1419 from yfdyh000/patch-1
jgoyvaerts Feb 10, 2022
f94a281
Fix requestOption copyWith's argument type for data
NiKoTron Feb 10, 2022
d177a54
Merge pull request #1417 from flutterchina/dependabot/github_actions/…
kuhnroyal Feb 10, 2022
e0bb1c5
add badssl to exception_test.dart
yfdyh000 Feb 13, 2022
6cdda0a
Merge pull request #1421 from NiKoTron/fix-request-opt-arg-type-dynam…
kuhnroyal Feb 22, 2022
6d04ec9
Merge pull request #1424 from yfdyh000/badssl_h1test
kuhnroyal Feb 22, 2022
1d7e594
Correct JSON MIME Type detection
Mar 4, 2022
5ddb661
fix: abort request when timeout occurs
amondnet Mar 7, 2022
cba129c
Typo
lukaskirner Mar 28, 2022
7308fd8
Format mimetype_test.dart
Mar 29, 2022
2782c1a
Merge pull request #1440 from amondnet/abort-connection
wendux Mar 29, 2022
a5d84a4
update doc
wendux Mar 29, 2022
7886329
Merge branch 'develop' of https://github.com/flutterchina/dio into de…
wendux Mar 29, 2022
545142c
Merge pull request #1439 from lukaskirner/develop
wendux Mar 29, 2022
ab0c93e
update changelog
wendux Mar 29, 2022
6ef257a
Merge branch 'develop' of https://github.com/flutterchina/dio into de…
wendux Mar 29, 2022
f56ce11
release 4.0.5
wendux Mar 29, 2022
ac78e61
fix #1452
wendux Mar 31, 2022
0e3e3f2
Update dio/lib/src/adapters/browser_adapter.dart
ueman Oct 19, 2022
23c0c3f
Update dio/lib/src/adapters/io_adapter.dart
ueman Oct 19, 2022
bb3c6e3
Merge branch 'develop' into improve-stacktraces
ueman Oct 21, 2022
0bb6422
Delete .DS_Store
ueman Oct 21, 2022
92b5617
don't force unwrap
ueman Oct 21, 2022
38c0b72
fix changelog
ueman Oct 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ stable, beta, dev, 2.12.1 ]
sdk: [ stable, beta, 2.12.1 ]
platform: [ vm, chrome ]
defaults:
run:
working-directory: dio
Expand All @@ -54,12 +55,12 @@ jobs:
with:
sdk: ${{ matrix.sdk }}
- run: pub get
- run: dart test --chain-stack-traces
- run: dart test --chain-stack-traces --platform=${{ matrix.platform }}
- name: Upload test report
uses: actions/upload-artifact@v2
if: always() && matrix.sdk == 'stable'
if: always()
with:
name: test-results
name: test-results-${{ matrix.sdk }}-${{ matrix.platform }}
path: dio/build/reports/test-results.json

publish-dry-run:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/example-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
working-directory: example_flutter_app
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2.2.1
- uses: subosito/flutter-action@v2.3.0
with:
cache: true
channel: stable
Expand All @@ -34,7 +34,7 @@ jobs:
working-directory: example_flutter_app
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2.2.1
- uses: subosito/flutter-action@v2.3.0
with:
cache: true
channel: stable
Expand All @@ -48,7 +48,7 @@ jobs:
working-directory: example_flutter_app
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2.2.1
- uses: subosito/flutter-action@v2.3.0
with:
cache: true
channel: stable
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/plugin_cookie_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ stable, beta, dev, 2.12.1 ]
sdk: [ stable, beta, 2.12.1 ]
defaults:
run:
working-directory: plugins/cookie_manager
Expand All @@ -57,7 +57,7 @@ jobs:
- run: dart test --chain-stack-traces
- name: Upload test report
uses: actions/upload-artifact@v2
if: always() && matrix.sdk == 'stable'
if: always()
with:
name: test-results
name: test-results-${{ matrix.sdk }}
path: plugins/cookie_manager/build/reports/test-results.json
6 changes: 3 additions & 3 deletions .github/workflows/plugin_http2_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ stable, beta, dev, 2.12.1 ]
sdk: [ stable, beta, 2.12.1 ]
defaults:
run:
working-directory: plugins/http2_adapter
Expand All @@ -57,7 +57,7 @@ jobs:
- run: dart test --chain-stack-traces
- name: Upload test report
uses: actions/upload-artifact@v2
if: always() && matrix.sdk == 'stable'
if: always()
with:
name: test-results
name: test-results-${{ matrix.sdk }}
path: plugins/http2_adapter/build/reports/test-results.json
18 changes: 16 additions & 2 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,24 @@ jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts

artifacts_url=${{ github.event.workflow_run.artifacts_url }}

gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish test reports
uses: dorny/test-reporter@v1
with:
name: ${{ github.event.workflow_run.workflow.name }} Test results
artifact: test-results
path: '**/*.json'
path: 'artifacts/**/test-results.json'
reporter: dart-json
7 changes: 4 additions & 3 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dio是一个强大的Dart Http请求库,支持Restful API、FormData、拦截

```yaml
dependencies:
dio: ^4.0.5-beta1
dio: ^4.0.6
```

> 如果你是dio 3.x 用户,想了解4.0的变更,请参考 [4.x更新列表](./migration_to_4.x.md)!
Expand All @@ -39,11 +39,12 @@ void getHttp() async {

| Plugins | Status | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [dio_cookie_manager](https://github.com/flutterchina/dio/tree/master/plugins/cookie_manager) | [![Pub](https://img.shields.io/pub/v/dio_http2_adapter.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_http2_adapter) | A cookie manager for Dio |
| [dio_http2_adapter](https://github.com/flutterchina/dio/tree/master/plugins/http2_adapter) | [![Pub](https://img.shields.io/pub/v/dio_cookie_manager.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_cookie_manager) | A Dio HttpClientAdapter which support Http/2.0 |
| [dio_cookie_manager](https://github.com/flutterchina/dio/tree/master/plugins/cookie_manager) | [![Pub](https://img.shields.io/pub/v/dio_cookie_manager.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_cookie_manager) | A cookie manager for Dio |
| [dio_http2_adapter](https://github.com/flutterchina/dio/tree/master/plugins/http2_adapter) | [![Pub](https://img.shields.io/pub/v/dio_http2_adapter.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_http2_adapter) | A Dio HttpClientAdapter which support Http/2.0 |
| [dio_smart_retry](https://github.com/rodion-m/dio_smart_retry) | [![Pub](https://img.shields.io/pub/v/dio_smart_retry.svg?style=flat-square)](https://pub.dev/packages/dio_smart_retry) | Flexible retry library for Dio |
| [http_certificate_pinning](https://github.com/diefferson/http_certificate_pinning) | [![Pub](https://img.shields.io/pub/v/http_certificate_pinning.svg?style=flat-square)](https://pub.dev/packages/http_certificate_pinning) | Https Certificate pinning for Flutter |
| [curl_logger_dio_interceptor](https://github.com/OwnWeb/curl_logger_dio_interceptor) | [![Pub](https://img.shields.io/pub/v/curl_logger_dio_interceptor.svg?style=flat-square)](https://pub.dev/packages/curl_logger_dio_interceptor) | A Flutter curl-command generator for Dio. |
| [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) | [![Pub](https://img.shields.io/pub/v/dio_cache_interceptor.svg?style=flat-square)](https://pub.dev/packages/dio_cache_interceptor) | Dio HTTP cache interceptor with multiple stores respecting HTTP directives (or not) |
| [dio_http_cache](https://github.com/hurshi/dio-http-cache) | [![Pub](https://img.shields.io/pub/v/dio_http_cache.svg?style=flat-square)](https://pub.dev/packages/dio_http_cache) | A simple cache library for Dio like Rxcache in Android |
| [pretty_dio_logger](https://github.com/Milad-Akarie/pretty_dio_logger) | [![Pub](https://img.shields.io/pub/v/pretty_dio_logger.svg?style=flat-square)](https://pub.dev/packages/pretty_dio_logger) | Pretty Dio logger is a Dio interceptor that logs network calls in a pretty, easy to read format. |

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A powerful Http client for Dart, which supports Interceptors, Global configurati

```yaml
dependencies:
dio: ^4.0.5-beta1
dio: ^4.0.6
```
> Already know Dio 3 and just want to learn about what's new in Dio 4? Check out the [Migration Guide](./migration_to_4.x.md)!

Expand All @@ -38,11 +38,12 @@ void getHttp() async {

| Plugins | Status | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [dio_cookie_manager](https://github.com/flutterchina/dio/tree/master/plugins/cookie_manager) | [![Pub](https://img.shields.io/pub/v/dio_http2_adapter.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_http2_adapter) | A cookie manager for Dio |
| [dio_http2_adapter](https://github.com/flutterchina/dio/tree/master/plugins/http2_adapter) | [![Pub](https://img.shields.io/pub/v/dio_cookie_manager.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_cookie_manager) | A Dio HttpClientAdapter which support Http/2.0 |
| [dio_cookie_manager](https://github.com/flutterchina/dio/tree/master/plugins/cookie_manager) | [![Pub](https://img.shields.io/pub/v/dio_cookie_manager.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_cookie_manager) | A cookie manager for Dio |
| [dio_http2_adapter](https://github.com/flutterchina/dio/tree/master/plugins/http2_adapter) | [![Pub](https://img.shields.io/pub/v/dio_http2_adapter.svg?style=flat-square)](https://pub.dartlang.org/packages/dio_http2_adapter) | A Dio HttpClientAdapter which support Http/2.0 |
| [dio_smart_retry](https://github.com/rodion-m/dio_smart_retry) | [![Pub](https://img.shields.io/pub/v/dio_smart_retry.svg?style=flat-square)](https://pub.dev/packages/dio_smart_retry) | Flexible retry library for Dio |
| [http_certificate_pinning](https://github.com/diefferson/http_certificate_pinning) | [![Pub](https://img.shields.io/pub/v/http_certificate_pinning.svg?style=flat-square)](https://pub.dev/packages/http_certificate_pinning) | Https Certificate pinning for Flutter |
| [curl_logger_dio_interceptor](https://github.com/OwnWeb/curl_logger_dio_interceptor) | [![Pub](https://img.shields.io/pub/v/curl_logger_dio_interceptor.svg?style=flat-square)](https://pub.dev/packages/curl_logger_dio_interceptor) | A Flutter curl-command generator for Dio. |
| [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) | [![Pub](https://img.shields.io/pub/v/dio_cache_interceptor.svg?style=flat-square)](https://pub.dev/packages/dio_cache_interceptor) | Dio HTTP cache interceptor with multiple stores respecting HTTP directives (or not) |
| [dio_http_cache](https://github.com/hurshi/dio-http-cache) | [![Pub](https://img.shields.io/pub/v/dio_http_cache.svg?style=flat-square)](https://pub.dev/packages/dio_http_cache) | A simple cache library for Dio like Rxcache in Android |
| [pretty_dio_logger](https://github.com/Milad-Akarie/pretty_dio_logger) | [![Pub](https://img.shields.io/pub/v/pretty_dio_logger.svg?style=flat-square)](https://pub.dev/packages/pretty_dio_logger) | Pretty Dio logger is a Dio interceptor that logs network calls in a pretty, easy to read format. |

Expand Down Expand Up @@ -71,9 +72,9 @@ Welcome to submit Dio's third-party plugins and related libraries [here](https:/

- [Sending FormData](#sending-formdata)

- [Transformer](#Transformer)
- [Transformer](#transformer)

- [Set proxy and HttpClient config](#set-proxy-and-httpclient-config)
- [Using proxy](#using-proxy)

- [Https certificate verification](#https-certificate-verification)

Expand Down
22 changes: 14 additions & 8 deletions dio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# Unreleased
- require Dart `2.12.1` which fixes exception handling for secure socket connections (https://github.com/dart-lang/sdk/issues/45214)
- `ResponseBody.statusCode` is now non-nullable
- Only delete file if it exists when downloading.

# Unreleased 5.0
- add option to instantiate a `HttpClientAdapter`, which is platform independent

# 4.0.5-beta1
- Add option to instantiate a `HttpClientAdapter`, which is platform independent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we need to change the base branch to develop.


# 4.0.6

- fix #1452

# 4.0.5

- require Dart `2.12.1` which fixes exception handling for secure socket connections (https://github.com/dart-lang/sdk/issues/45214)
- Only delete file if it exists when downloading.
- Fix `BrowserHttpClientAdapter` canceled hangs
- Correct JSON MIME Type detection
- [Web] support send/receive progress in web platform
- refactor timeout logic
- use 'arraybuffer' instead of 'blob' for xhr requests in web platform

# 4.0.4

- Fix fetching null data in a response

# 4.0.3
Expand Down Expand Up @@ -247,4 +253,4 @@ First Stable version for 2.x

## 0.0.1

- Initial version, created by Stagehand
- Initial version, created by Stagehand
3 changes: 2 additions & 1 deletion dio/README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dio是一个强大的Dart Http请求库,支持Restful API、FormData、拦截

```yaml
dependencies:
dio: ^4.0.5-beta1
dio: ^4.0.6
```

> 如果你是dio 3.x 用户,想了解4.0的变更,请参考 [4.x更新列表](./migration_to_4.x.md)!
Expand Down Expand Up @@ -44,6 +44,7 @@ void getHttp() async {
| [dio_smart_retry](https://github.com/rodion-m/dio_smart_retry) | [![Pub](https://img.shields.io/pub/v/dio_smart_retry.svg?style=flat-square)](https://pub.dev/packages/dio_smart_retry) | Flexible retry library for Dio |
| [http_certificate_pinning](https://github.com/diefferson/http_certificate_pinning) | [![Pub](https://img.shields.io/pub/v/http_certificate_pinning.svg?style=flat-square)](https://pub.dev/packages/http_certificate_pinning) | Https Certificate pinning for Flutter |
| [curl_logger_dio_interceptor](https://github.com/OwnWeb/curl_logger_dio_interceptor) | [![Pub](https://img.shields.io/pub/v/curl_logger_dio_interceptor.svg?style=flat-square)](https://pub.dev/packages/curl_logger_dio_interceptor) | A Flutter curl-command generator for Dio. |
| [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) | [![Pub](https://img.shields.io/pub/v/dio_cache_interceptor.svg?style=flat-square)](https://pub.dev/packages/dio_cache_interceptor) | Dio HTTP cache interceptor with multiple stores respecting HTTP directives (or not) |
| [dio_http_cache](https://github.com/hurshi/dio-http-cache) | [![Pub](https://img.shields.io/pub/v/dio_http_cache.svg?style=flat-square)](https://pub.dev/packages/dio_http_cache) | A simple cache library for Dio like Rxcache in Android |
| [pretty_dio_logger](https://github.com/Milad-Akarie/pretty_dio_logger) | [![Pub](https://img.shields.io/pub/v/pretty_dio_logger.svg?style=flat-square)](https://pub.dev/packages/pretty_dio_logger) | Pretty Dio logger is a Dio interceptor that logs network calls in a pretty, easy to read format. |

Expand Down
3 changes: 2 additions & 1 deletion dio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A powerful Http client for Dart, which supports Interceptors, Global configurati

```yaml
dependencies:
dio: ^4.0.5-beta1
dio: ^4.0.6
```
> Already know Dio 3 and just want to learn about what's new in Dio 4? Check out the [Migration Guide](./migration_to_4.x.md)!

Expand Down Expand Up @@ -43,6 +43,7 @@ void getHttp() async {
| [dio_smart_retry](https://github.com/rodion-m/dio_smart_retry) | [![Pub](https://img.shields.io/pub/v/dio_smart_retry.svg?style=flat-square)](https://pub.dev/packages/dio_smart_retry) | Flexible retry library for Dio |
| [http_certificate_pinning](https://github.com/diefferson/http_certificate_pinning) | [![Pub](https://img.shields.io/pub/v/http_certificate_pinning.svg?style=flat-square)](https://pub.dev/packages/http_certificate_pinning) | Https Certificate pinning for Flutter |
| [curl_logger_dio_interceptor](https://github.com/OwnWeb/curl_logger_dio_interceptor) | [![Pub](https://img.shields.io/pub/v/curl_logger_dio_interceptor.svg?style=flat-square)](https://pub.dev/packages/curl_logger_dio_interceptor) | A Flutter curl-command generator for Dio. |
| [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) | [![Pub](https://img.shields.io/pub/v/dio_cache_interceptor.svg?style=flat-square)](https://pub.dev/packages/dio_cache_interceptor) | Dio HTTP cache interceptor with multiple stores respecting HTTP directives (or not) |
| [dio_http_cache](https://github.com/hurshi/dio-http-cache) | [![Pub](https://img.shields.io/pub/v/dio_http_cache.svg?style=flat-square)](https://pub.dev/packages/dio_http_cache) | A simple cache library for Dio like Rxcache in Android |
| [pretty_dio_logger](https://github.com/Milad-Akarie/pretty_dio_logger) | [![Pub](https://img.shields.io/pub/v/pretty_dio_logger.svg?style=flat-square)](https://pub.dev/packages/pretty_dio_logger) | Pretty Dio logger is a Dio interceptor that logs network calls in a pretty, easy to read format. |

Expand Down
4 changes: 2 additions & 2 deletions dio/lib/src/adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class ResponseBody {
Stream<Uint8List> stream;

/// the response headers
Map<String, List<String>> headers;
late Map<String, List<String>> headers;

/// Http status code
int statusCode;
int? statusCode;

/// Returns the reason phrase associated with the status code.
/// The reason phrase must be set before the body is written
Expand Down
Loading