Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: preserve merged headers in repository-meta fetch options (spread order bug) #2765

Copy link
Copy link

Description

@coderabbitai
Issue body actions

Summary

In shared/utils/repository-meta.ts, the object spread order when building fetch options causes ...options to overwrite the entire headers object, discarding the merged User-Agent: npmx header (and any other headers built up prior to the spread).

This is a pre-existing issue that originated in app/composables/useRepoMeta.ts on main and was moved as-is into the new shared utility in #2764.

Problem

The current pattern (at 8 locations) is:

// Incorrect — outer ...options clobbers the headers object
{ headers: { 'User-Agent': 'npmx', ...options.headers }, ...options }

Fix

Spread options first, then override headers with the merged value:

// Correct — User-Agent preserved, caller headers merged in
{ ...options, headers: { 'User-Agent': 'npmx', ...options.headers } }

Affected locations

  • shared/utils/repository-meta.ts lines 118, 160, 197, 236, 275, 321, 422, 466

References

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.