Skip to content

Conversation

@WillianAgostini
Copy link
Contributor

Fixes #6734

Example Usage

import axios, { AxiosResponse } from "axios";

type ResponseBody = {...}

type ResponseHeaders = {
  'x-header': string;
}

const response = await axios.get<ResponseBody, AxiosResponse<ResponseBody, any, ResponseHeaders>>("https://jsonplaceholder.typicode.com/todos/1");
console.log(response.headers['x-header']);

@WillianAgostini WillianAgostini force-pushed the feat/6734 branch 2 times, most recently from 82e5449 to c75545c Compare February 18, 2025 01:24
@github-actions github-actions bot added pr::feature PR that adds a feature pr::types PR that changes project types definiton (.d.ts) labels Jul 20, 2025
Copy link
Member

@jasonsaayman jasonsaayman left a comment

Choose a reason for hiding this comment

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

thanks @WillianAgostini i was going to add something similar as i have a similar requirement in a project, but you already did it 🤯 thanks

@jasonsaayman jasonsaayman merged commit 7960d34 into axios:v1.x Aug 12, 2025
12 checks passed
@jasonsaayman jasonsaayman added this to the v2.0.0 milestone Aug 12, 2025
@github-actions github-actions bot mentioned this pull request Sep 11, 2025
@github-actions
Copy link
Contributor

Hi, @WillianAgostini! This PR has been published in v1.12.0 release. Thank you for your contribution ❤️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr::feature PR that adds a feature pr::types PR that changes project types definiton (.d.ts) v1.12.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add generic type to response headers

2 participants