You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In all interceptors, you can interfere with their execution flow. If you want to resolve the request/response with some custom data,you can return a `Response` object or return `dio.resolve(data)`. If you want to reject the request/response with a error message, you can return a `DioError` object or return `dio.reject(errMsg)` .
293
+
In all interceptors, you can interfere with their execution flow. If you want to resolve the request/response with some custom data,you can return a `Response` object or return `dio.resolve(data)`. If you want to reject the request/response with a error message, you can return a `DioError` object or return `dio.reject(errMsg)` .
you can clean the waiting queue by calling `clear()`;
337
+
You can clean the waiting queue by calling `clear()`;
338
338
339
339
### aliases
340
340
341
-
When the **request** interceptor is locked, the incoming request will pause, this is equivalent to we locked the current dio instance, Therefore, Dio provied the two aliases for the `lock/unlock` of **request** interceptors.
341
+
When the **request** interceptor is locked, the incoming request will pause, this is equivalent to we locked the current dio instance, Therefore, Dio provied the two aliases for the `lock/unlock` of **request** interceptors.
342
342
343
343
**dio.lock() == dio.interceptor.request.lock()**
344
344
@@ -350,7 +350,7 @@ When the **request** interceptor is locked, the incoming request will pause, thi
350
350
351
351
### Example
352
352
353
-
Because of security reasons, we need all the requests to set up a csrfToken in the header, if csrfToken does not exist, we need to request a csrfToken first, and then perform the network request, because the request csrfToken progress is asynchronous, so we need to execute this async request in request interceptor. the code is as follows:
353
+
Because of security reasons, we need all the requests to set up a csrfToken in the header, if csrfToken does not exist, we need to request a csrfToken first, and then perform the network request, because the request csrfToken progress is asynchronous, so we need to execute this async request in request interceptor. The code is as follows:
dio.post("/info",data:{"id":5}, options: new Options(contentType:ContentType.parse("application/x-www-form-urlencoded")))
453
453
```
454
454
455
-
There is a example [here](https://github.com/flutterchina/dio/tree/flutter/example/options.dart).
455
+
There is an example [here](https://github.com/flutterchina/dio/tree/flutter/example/options.dart).
456
456
457
457
## Sending FormData
458
458
459
-
You can also send FormData with Dio, which will send data in the `multipart/form-data`, and it supports upload files.
459
+
You can also send FormData with Dio, which will send data in the `multipart/form-data`, and it supports uploading files.
460
460
461
461
```dart
462
462
FormData formData = new FormData.from({
@@ -473,13 +473,13 @@ There is a complete example [here](https://github.com/flutterchina/dio/tree/flut
473
473
474
474
## Transformer
475
475
476
-
`Transformer` allows changes to the request/response data before it is sent/received to/from the server. This is only applicable for request methods 'PUT', 'POST', and 'PATCH'. Dio has already implemented a `DefaultTransformer`, and as the default `Transformer`. If you want to custom the transformation of request/response data, you can provide a `Transformer` by your self, and replace the `DefaultTransformer` by setting the `dio.transformer`.
476
+
`Transformer` allows changes to the request/response data before it is sent/received to/from the server. This is only applicable for request methods 'PUT', 'POST', and 'PATCH'. Dio has already implemented a `DefaultTransformer`, and as the default `Transformer`. If you want to customize the transformation of request/response data, you can provide a `Transformer` by your self, and replace the `DefaultTransformer` by setting the `dio.transformer`.
477
477
478
-
There is example for [customing Transformer](https://github.com/flutterchina/dio/blob/master/example/Transformer.dart).
478
+
There is an example for [customizing Transformer](https://github.com/flutterchina/dio/blob/flutter/example/Transformer.dart).
479
479
480
480
## Set proxy and HttpClient config
481
481
482
-
Dio use HttpClient to send http request, so you can config the `dio.httpClient` to support `porxy`, for example:
482
+
Dio uses HttpClient to send http request, so you can config the `dio.httpClient` to support `proxy`, for example:
0 commit comments