Skip to content

Conversation

@Huzaif-nabi
Copy link

Summary

This PR corrects the TypeScript types for common response headers to use lowercase keys, aligning them with Axios's documented runtime behavior. This solution explicitly addresses the maintainer's feedback on issue #7110 by ensuring the type system correctly handles any header casing.

Problem

At runtime, Axios normalizes all incoming response header keys to lowercase (e.g., content-type). However, the CommonResponseHeadersList type definition used TitleCase keys (e.g., 'Content-Type').

This created a discrepancy where TypeScript would incorrectly approve of accessing a TitleCase header, which would be undefined at runtime.

// Previously, this was considered valid by TypeScript but failed at runtime
const titleCase = response.headers['Content-Type']; // undefined

@github-actions github-actions bot added pr::fix PR that fixes a bug pr::types PR that changes project types definiton (.d.ts) labels Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr::fix PR that fixes a bug pr::types PR that changes project types definiton (.d.ts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant