From 3dad633db9361927c5adc098896af2fd8a6fd1f2 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Sun, 1 Oct 2023 18:13:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Fix=20READMEs=20(#1987)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Walk through all READMEs and fix them. ### New Pull Request Checklist - [x] I have read the [Documentation](https://pub.dev/documentation/dio/latest/) - [x] I have searched for a similar pull request in the [project](https://github.com/cfug/dio/pulls) and found none - [x] I have updated this branch with the latest `main` branch to avoid conflicts (via merge from master or rebase) - [ ] I have added the required tests to prove the fix/feature I'm adding - [x] I have updated the documentation (if necessary) - [x] I have run the tests without failures - [ ] I have updated the `CHANGELOG.md` in the corresponding package --- README-ZH.md | 4 +++- README.md | 4 +++- dio/README-ZH.md | 36 +++++++++++++++------------- dio/README.md | 15 +++++++----- plugins/cookie_manager/README.md | 3 ++- plugins/http2_adapter/README.md | 3 ++- plugins/native_dio_adapter/README.md | 10 +++++--- 7 files changed, 46 insertions(+), 29 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index 1cfc53025..c40ccc865 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -10,7 +10,9 @@ Language: [English](README.md) | 简体中文 [![Pub](https://img.shields.io/pub/v/dio.svg?label=dev&include_prereleases)](https://pub.flutter-io.cn/packages/dio) **在你更新之前:大版本和次要版本可能会包含不兼容的重大改动。
-请阅读 [迁移指南](dio/migration_guide.md) 了解完整的重大变更内容。** +请阅读 [迁移指南][] 了解完整的重大变更内容。** + +[迁移指南]: https://pub.flutter-io.cn/documentation/dio/latest/topics/Migration%20Guide-topic.html ### 插件 diff --git a/README.md b/README.md index c8acddf94..2b69a0971 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ Please move specific paths for project instructions. [![Pub](https://img.shields.io/pub/v/dio.svg?label=dev&include_prereleases)](https://pub.dev/packages/dio) **Before you upgrade: Breaking changes might happen in major and minor versions of packages.
-See the [Migration Guide](dio/migration_guide.md) for the complete breaking changes list.** +See the [Migration Guide][] for the complete breaking changes list.** + +[Migration Guide]: https://pub.dev/documentation/dio/latest/topics/Migration%20Guide-topic.html ### Plugins diff --git a/dio/README-ZH.md b/dio/README-ZH.md index 0e06ee863..545b64958 100644 --- a/dio/README-ZH.md +++ b/dio/README-ZH.md @@ -29,6 +29,8 @@ dio 是一个强大的 HTTP 网络请求库,支持全局配置、Restful API * [QueuedInterceptor](#queuedinterceptor) * [例子](#例子) * [日志拦截器](#日志拦截器) + * [Dart](#dart) + * [Flutter](#flutter) * [自定义拦截器](#自定义拦截器) * [错误处理](#错误处理) * [DioException](#dioexception) @@ -54,11 +56,14 @@ dio 是一个强大的 HTTP 网络请求库,支持全局配置、Restful API ### 添加依赖 -依照文档将 `dio` 包添加为 [pubspec 的依赖](https://pub.flutter-io.cn/packages/dio/install)。 +依照文档将 `dio` 包添加为 +[pubspec 的依赖](https://pub.flutter-io.cn/packages/dio/install)。 **在你更新之前:大版本和次要版本可能会包含不兼容的重大改动。
请阅读 [迁移指南][] 了解完整的重大变更内容。** +[迁移指南]: https://pub.flutter-io.cn/documentation/dio/latest/topics/Migration%20Guide-topic.html + ## 一个极简的示例 ```dart @@ -79,20 +84,20 @@ void getHttp() async { ### 相关插件 -| 仓库 | 最新版本 | 描述 | -|--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------| -| [dio_cookie_manager](https://github.com/cfug/dio/blob/main/plugins/cookie_manager) | [![Pub](https://img.shields.io/pub/v/dio_cookie_manager.svg)](https://pub.flutter-io.cn/packages/dio_cookie_manager) | Cookie 管理 | -| [dio_http2_adapter](https://github.com/cfug/dio/blob/main/plugins/http2_adapter) | [![Pub](https://img.shields.io/pub/v/dio_http2_adapter.svg)](https://pub.flutter-io.cn/packages/dio_http2_adapter) | 支持 HTTP/2 的自定义适配器 | -| [native_dio_adapter](https://github.com/cfug/dio/blob/main/plugins/native_dio_adapter) | [![Pub](https://img.shields.io/pub/v/native_dio_adapter.svg)](https://pub.flutter-io.cn/packages/native_dio_adapter) | 使用 cupertino_http 和 cronet_http 以适配器代理实现的原生网络请求功能。 | -| [dio_smart_retry](https://github.com/rodion-m/dio_smart_retry) | [![Pub](https://img.shields.io/pub/v/dio_smart_retry.svg)](https://pub.flutter-io.cn/packages/dio_smart_retry) | 支持灵活地请求重试 | -| [http_certificate_pinning](https://github.com/diefferson/http_certificate_pinning) | [![Pub](https://img.shields.io/pub/v/http_certificate_pinning.svg)](https://pub.flutter-io.cn/packages/http_certificate_pinning) | 用于 Flutter 的 HTTPS 证书锁定 | -| [dio_intercept_to_curl](https://github.com/blackflamedigital/dio_intercept_to_curl) | [![Pub](https://img.shields.io/pub/v/dio_intercept_to_curl.svg)](https://pub.flutter-io.cn/packages/dio_intercept_to_curl) | 用于 Flutter 的 CURL 命令生成器 | -| [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) | [![Pub](https://img.shields.io/pub/v/dio_cache_interceptor.svg)](https://pub.flutter-io.cn/packages/dio_cache_interceptor) | 具有多个符合 HTTP 指令的 HTTP 缓存拦截器, | -| [dio_http_cache](https://github.com/hurshi/dio-http-cache) | [![Pub](https://img.shields.io/pub/v/dio_http_cache.svg)](https://pub.flutter-io.cn/packages/dio_http_cache) | 类似 Android 中的 RxCache 的缓存管理 | -| [pretty_dio_logger](https://github.com/Milad-Akarie/pretty_dio_logger) | [![Pub](https://img.shields.io/pub/v/pretty_dio_logger.svg)](https://pub.flutter-io.cn/packages/pretty_dio_logger) | 基于拦截器的简明易读的请求日志打印 | -| [dio_image_provider](https://github.com/ueman/image_provider) | [![Pub](https://img.shields.io/pub/v/dio_image_provider.svg)](https://pub.flutter-io.cn/packages/dio_image_provider) | 基于 Dio 的图片加载 | -| [flutter_ume_kit_dio](https://github.com/cfug/flutter_ume_kits/tree/main/packages/flutter_ume_kit_dio) | [![Pub](https://img.shields.io/pub/v/flutter_ume_kit_dio.svg)](https://pub.flutter-io.cn/packages/flutter_ume_kit_dio) | flutter_ume 上的 dio 调试插件 | -| [talker_dio_logger](https://github.com/Frezyx/talker/tree/master/packages/talker_dio_logger) | [![Pub](https://img.shields.io/pub/v/talker_dio_logger.svg)](https://pub.dev/packages/talker_dio_logger) | 基于 talker 的轻量级和可定制的 dio 记录器 | +| 仓库 | 最新版本 | 描述 | +|--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------| +| [dio_cookie_manager](https://github.com/cfug/dio/blob/main/plugins/cookie_manager) | [![Pub](https://img.shields.io/pub/v/dio_cookie_manager.svg)](https://pub.flutter-io.cn/packages/dio_cookie_manager) | Cookie 管理 | +| [dio_http2_adapter](https://github.com/cfug/dio/blob/main/plugins/http2_adapter) | [![Pub](https://img.shields.io/pub/v/dio_http2_adapter.svg)](https://pub.flutter-io.cn/packages/dio_http2_adapter) | 支持 HTTP/2 的自定义适配器 | +| [native_dio_adapter](https://github.com/cfug/dio/blob/main/plugins/native_dio_adapter) | [![Pub](https://img.shields.io/pub/v/native_dio_adapter.svg)](https://pub.flutter-io.cn/packages/native_dio_adapter) | 使用 cupertino_http 和 cronet_http 以适配器代理实现的原生网络请求功能。 | +| [dio_smart_retry](https://github.com/rodion-m/dio_smart_retry) | [![Pub](https://img.shields.io/pub/v/dio_smart_retry.svg)](https://pub.flutter-io.cn/packages/dio_smart_retry) | 支持灵活地请求重试 | +| [http_certificate_pinning](https://github.com/diefferson/http_certificate_pinning) | [![Pub](https://img.shields.io/pub/v/http_certificate_pinning.svg)](https://pub.flutter-io.cn/packages/http_certificate_pinning) | 用于 Flutter 的 HTTPS 证书锁定 | +| [dio_intercept_to_curl](https://github.com/blackflamedigital/dio_intercept_to_curl) | [![Pub](https://img.shields.io/pub/v/dio_intercept_to_curl.svg)](https://pub.flutter-io.cn/packages/dio_intercept_to_curl) | 用于 Flutter 的 CURL 命令生成器 | +| [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) | [![Pub](https://img.shields.io/pub/v/dio_cache_interceptor.svg)](https://pub.flutter-io.cn/packages/dio_cache_interceptor) | 具有多个符合 HTTP 指令的 HTTP 缓存拦截器, | +| [dio_http_cache](https://github.com/hurshi/dio-http-cache) | [![Pub](https://img.shields.io/pub/v/dio_http_cache.svg)](https://pub.flutter-io.cn/packages/dio_http_cache) | 类似 Android 中的 RxCache 的缓存管理 | +| [pretty_dio_logger](https://github.com/Milad-Akarie/pretty_dio_logger) | [![Pub](https://img.shields.io/pub/v/pretty_dio_logger.svg)](https://pub.flutter-io.cn/packages/pretty_dio_logger) | 基于拦截器的简明易读的请求日志打印 | +| [dio_image_provider](https://github.com/ueman/image_provider) | [![Pub](https://img.shields.io/pub/v/dio_image_provider.svg)](https://pub.flutter-io.cn/packages/dio_image_provider) | 基于 Dio 的图片加载 | +| [flutter_ume_kit_dio](https://github.com/cfug/flutter_ume_kits/tree/main/packages/flutter_ume_kit_dio) | [![Pub](https://img.shields.io/pub/v/flutter_ume_kit_dio.svg)](https://pub.flutter-io.cn/packages/flutter_ume_kit_dio) | flutter_ume 上的 dio 调试插件 | +| [talker_dio_logger](https://github.com/Frezyx/talker/tree/master/packages/talker_dio_logger) | [![Pub](https://img.shields.io/pub/v/talker_dio_logger.svg)](https://pub.flutter-io.cn/packages/talker_dio_logger) | 基于 talker 的轻量级和可定制的 dio 记录器 | ### 相关的项目 @@ -881,6 +886,5 @@ class MyDio with DioMixin implements Dio { 你可以参考简单请求的定义修改你的请求,或者为你的服务加上 CORS 中间件进行跨域处理。 -[迁移指南]: ./migration_guide.md [简单请求]: https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CORS#%E7%AE%80%E5%8D%95%E8%AF%B7%E6%B1%82 [CORS 预检]: https://developer.mozilla.org/zh-CN/docs/Glossary/Preflight_request diff --git a/dio/README.md b/dio/README.md index a77ef77b4..cf38d5c26 100644 --- a/dio/README.md +++ b/dio/README.md @@ -16,11 +16,10 @@ Timeout, Custom adapters, Transformers, etc. * [dio](#dio) * [Get started](#get-started) - * [Add dependency](#add-dependency) + * [Install](#install) * [Super simple to use](#super-simple-to-use) * [Awesome dio](#awesome-dio) * [Plugins](#plugins) - * [Related Projects](#related-projects) * [Examples](#examples) * [Dio APIs](#dio-apis) * [Creating an instance and set default configs.](#creating-an-instance-and-set-default-configs) @@ -31,6 +30,8 @@ Timeout, Custom adapters, Transformers, etc. * [QueuedInterceptor](#queuedinterceptor) * [Example](#example) * [LogInterceptor](#loginterceptor) + * [Dart](#dart) + * [Flutter](#flutter) * [Custom Interceptor](#custom-interceptor) * [Handling Errors](#handling-errors) * [DioException](#dioexception) @@ -56,11 +57,13 @@ Timeout, Custom adapters, Transformers, etc. ### Install -Add the `dio` package to your [pubspec dependencies](https://pub.dev/packages/dio/install). - +Add the `dio` package to your +[pubspec dependencies](https://pub.dev/packages/dio/install). **Before you upgrade: Breaking changes might happen in major and minor versions of packages.
-See the [Migration Guide](https://pub.dev/documentation/dio/latest/topics/Migration%20Guide-topic.html) for the complete breaking changes list.** +See the [Migration Guide][] for the complete breaking changes list.** + +[Migration Guide]: https://pub.dev/documentation/dio/latest/topics/Migration%20Guide-topic.html ### Super simple to use @@ -601,7 +604,7 @@ and it supports uploading files. final formData = FormData.fromMap({ 'name': 'dio', 'date': DateTime.now().toIso8601String(), - 'file': await MultipartFile.fromFile('./text.txt',filename: 'upload.txt'), + 'file': await MultipartFile.fromFile('./text.txt', filename: 'upload.txt'), }); final response = await dio.post('/info', data: formData); ``` diff --git a/plugins/cookie_manager/README.md b/plugins/cookie_manager/README.md index 043dabd9c..4358009f2 100644 --- a/plugins/cookie_manager/README.md +++ b/plugins/cookie_manager/README.md @@ -8,7 +8,8 @@ A cookie manager combines cookie_jar and dio, based on the interceptor algorithm ### Install -Add the `dio_cookie_manager` package to your [pubspec dependencies](https://pub.dev/packages/dio_cookie_manager/install). +Add the `dio_cookie_manager` package to your +[pubspec dependencies](https://pub.dev/packages/dio_cookie_manager/install). ### Usage diff --git a/plugins/http2_adapter/README.md b/plugins/http2_adapter/README.md index 79448f6b2..6274c88b3 100644 --- a/plugins/http2_adapter/README.md +++ b/plugins/http2_adapter/README.md @@ -8,7 +8,8 @@ An adapter that combines HTTP/2 and dio. Supports reusing connections, header co ### Install -Add the `dio_http2_adapter` package to your [pubspec dependencies](https://pub.dev/packages/dio_http2_adapter/install). +Add the `dio_http2_adapter` package to your +[pubspec dependencies](https://pub.dev/packages/dio_http2_adapter/install). ### Usage diff --git a/plugins/native_dio_adapter/README.md b/plugins/native_dio_adapter/README.md index 774e12c6f..d79ba0cbe 100644 --- a/plugins/native_dio_adapter/README.md +++ b/plugins/native_dio_adapter/README.md @@ -5,7 +5,8 @@ [![popularity](https://img.shields.io/pub/popularity/native_dio_adapter)](https://pub.dev/packages/native_dio_adapter/score) [![pub points](https://img.shields.io/pub/points/native_dio_adapter)](https://pub.dev/packages/native_dio_adapter/score) -> Note: This uses the native http implementation on macOS, iOS and Android. Other platforms still use the Dart http stack. +> Note: This uses the native http implementation on macOS, iOS and Android. +> Other platforms still use the Dart http stack. > Please keep in mind that Android is still considered experimental. If you encounter bugs, consider fixing it by opening a PR or at least contribute a failing test case. @@ -19,7 +20,9 @@ Inspired by the [Dart 2.18 release blog](https://medium.com/dartlang/dart-2-18-f ## Motivation -Using the native platform implementation, rather than the socket-based [`dart:io` HttpClient](https://api.dart.dev/stable/dart-io/HttpClient-class.html) implementation, has several advantages: +Using the native platform implementation, rather than the socket-based +[`dart:io` HttpClient](https://api.dart.dev/stable/dart-io/HttpClient-class.html) implementation, +has several advantages: - It automatically supports platform features such VPNs and HTTP proxies. - It supports many more configuration options such as only allowing access through WiFi and blocking cookies. @@ -29,7 +32,8 @@ Using the native platform implementation, rather than the socket-based [`dart:io ### Install -Add the `native_dio_adapter` package to your [pubspec dependencies](https://pub.dev/packages/native_dio_adapter/install). +Add the `native_dio_adapter` package to your +[pubspec dependencies](https://pub.dev/packages/native_dio_adapter/install). ### Example