Skip to content

Include custom response headers#6782

Merged
jasonsaayman merged 1 commit intoaxios:v1.xfrom
WillianAgostini:feat/6734
Aug 12, 2025
Merged

Include custom response headers#6782
jasonsaayman merged 1 commit intoaxios:v1.xfrom
WillianAgostini:feat/6734

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']);

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add generic type to response headers

2 participants