mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
feat(http): add HTTP2 support; (#7150)
This commit is contained in:
@@ -87,6 +87,7 @@
|
||||
- [🔥 Custom fetch](#-custom-fetch)
|
||||
- [🔥 Using with Tauri](#-using-with-tauri)
|
||||
- [🔥 Using with SvelteKit](#-using-with-sveltekit-)
|
||||
- [🔥 HTTP2](#-http2)
|
||||
- [Semver](#semver)
|
||||
- [Promises](#promises)
|
||||
- [TypeScript](#typescript)
|
||||
@@ -1702,6 +1703,34 @@ export async function load({ fetch }) {
|
||||
}
|
||||
```
|
||||
|
||||
## 🔥 HTTP2
|
||||
|
||||
In version `1.13.0`, experimental `HTTP2` support was added to the `http` adapter.
|
||||
The `httpVersion` option is now available to select the protocol version used.
|
||||
Additional native options for the internal `session.request()` call can be passed via the `http2Options` config.
|
||||
This config also includes the custom `sessionTimeout` parameter, which defaults to `1000ms`.
|
||||
|
||||
```js
|
||||
const form = new FormData();
|
||||
|
||||
form.append('foo', '123');
|
||||
|
||||
const {data, headers, status} = await axios.post('https://httpbin.org/post', form, {
|
||||
httpVersion: 2,
|
||||
http2Options: {
|
||||
// rejectUnauthorized: false,
|
||||
// sessionTimeout: 1000
|
||||
},
|
||||
onUploadProgress(e) {
|
||||
console.log('upload progress', e);
|
||||
},
|
||||
onDownloadProgress(e) {
|
||||
console.log('download progress', e);
|
||||
},
|
||||
responseType: 'arraybuffer'
|
||||
});
|
||||
```
|
||||
|
||||
## Semver
|
||||
|
||||
Since Axios has reached a `v.1.0.0` we will fully embrace semver as per the spec [here](https://semver.org/)
|
||||
|
||||
Reference in New Issue
Block a user