Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
- [🔥 Custom fetch](#-custom-fetch)
- [🔥 Using with Tauri](#-using-with-tauri)
- [🔥 Using with SvelteKit](#-using-with-sveltekit-)
- [🔥 HTTP2](#-http2)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdownlint TOC indentation.
MD007 expects top‑level list items to be unindented.

✏️ Suggested fix
-  - [🔥 HTTP2](`#-http2`)
+ - [🔥 HTTP2](`#-http2`)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- [🔥 HTTP2](#-http2)
- [🔥 HTTP2](`#-http2`)
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

90-90: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

🤖 Prompt for AI Agents
In `@README.md` at line 90, The TOC entry for "🔥 HTTP2" is indented, violating
MD007; remove the leading spaces so the top-level list item is unindented (e.g.,
change the line containing "- [🔥 HTTP2](`#-http2`)" to start at column 0) to
satisfy markdownlint's top-level list rule.

- [Semver](#semver)
- [Promises](#promises)
- [TypeScript](#typescript)
Expand Down Expand Up @@ -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/)
Expand Down
4 changes: 4 additions & 0 deletions index.d.cts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ declare namespace axios {
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
httpVersion?: 1 | 2;
http2Options?: Record<string, any> & {
sessionTimeout?: number;
};
}

// Alias
Expand Down
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ export interface AxiosRequestConfig<D = any> {
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
parseReviver?: (this: any, key: string, value: any) => any;
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
httpVersion?: 1 | 2;
http2Options?: Record<string, any> & {
sessionTimeout?: number;
};
}

// Alias
Expand Down
Loading