Skip to content

Comments

fix: use Content-Type header in auth.ts#1995

Merged
AndreyHirsa merged 4 commits intolingodotdev:mainfrom
Nixxx19:fix/content-type-header-auth
Feb 18, 2026
Merged

fix: use Content-Type header in auth.ts#1995
AndreyHirsa merged 4 commits intolingodotdev:mainfrom
Nixxx19:fix/content-type-header-auth

Conversation

@Nixxx19
Copy link
Contributor

@Nixxx19 Nixxx19 commented Feb 18, 2026

Fixes #1985

Summary

Fixes invalid HTTP header name in auth.ts: replaces ContentType with "Content-Type" so the whoami request sends a valid Content-Type header.

Changes

  • Use "Content-Type": "application/json" instead of ContentType: "application/json" in packages/cli/src/cli/utils/auth.ts (line 25)
  • Aligns with HTTP spec and with existing usage in observability.ts

Testing

Business logic tests added:

  • No new unit tests (single-line header fix; behavior unchanged for correct servers)
  • Verified: grep "ContentType" returns nothing in auth.ts
  • Verified: auth.ts line 25 uses "Content-Type"
  • Verified via Node Headers that ContentType yields null for get('Content-Type') and "Content-Type" works
  • All tests pass locally

Visuals

Screenshot 2026-02-18 at 9 05 34 AM

Verification (Content-Type fix):

Screenshot below: terminal output from the verification command showing:

Screenshot 2026-02-18 at 9 12 33 AM
  1. No ContentType in auth.ts → OK
  2. auth.ts line 25"Content-Type": "application/json",
  3. Headers checkContentType → null; "Content-Type" → ok

Checklist

  • Changeset added (if version bump needed)
  • Tests cover business logic (not just happy path)
  • No breaking changes (or documented below)

Summary by CodeRabbit

  • Bug Fixes

    • Corrected HTTP header formatting for authentication requests (uses standard Content-Type), improving compatibility with authentication services.
  • Chores

    • Added a changeset entry to document and release the patch.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A single HTTP header name was corrected in the authentication utility from the invalid camelCase ContentType to the standard hyphenated format "Content-Type" to ensure proper header transmission in API requests.

Changes

Cohort / File(s) Summary
HTTP Header Correction
packages/cli/src/cli/utils/auth.ts
Changed header key from ContentType to "Content-Type" in the authenticator request.
Release metadata
.changeset/fast-badgers-thank.md
Added a changeset noting the patch that fixes the Content-Type header in the CLI auth utility.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • cherkanovart
  • Copilot

Poem

A rabbit hops with glee,
ContentType? No — hyphens we see!
"Content-Type" set just right,
Headers now take flight ✨
Hooray for tidy HTTP.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: use Content-Type header in auth.ts' clearly and concisely describes the main change: correcting the HTTP header name from ContentType to Content-Type.
Description check ✅ Passed The description includes a summary, detailed changes, comprehensive testing verification, and a filled-out checklist covering the key requirements from the template.
Linked Issues check ✅ Passed The PR successfully fixes the issue #1985 by replacing the invalid 'ContentType' header with the correct 'Content-Type' in auth.ts, and includes verification demonstrating the fix works correctly.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing issue #1985: correcting the HTTP header in auth.ts and adding the required changeset file; no extraneous changes are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AndreyHirsa
Copy link
Contributor

@Nixxx19 Hi! Can you please add changeset?

@Nixxx19
Copy link
Contributor Author

Nixxx19 commented Feb 18, 2026

@Nixxx19 Hi! Can you please add changeset?

hi @AndreyHirsa, so sorry about that! i completely missed it. i've just added the changeset now. thanks for the heads-up!

@AndreyHirsa AndreyHirsa merged commit a91ad24 into lingodotdev:main Feb 18, 2026
5 checks passed
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.

Bug: Fix ContentType header should be Content-Type in auth.ts

2 participants