Skip to content

fix: set correct Content-Type for opensearch.xml#115

Merged
danielroe merged 1 commit intonpmx-dev:mainfrom
BYK:fix/opensearch-content-type
Jan 26, 2026
Merged

fix: set correct Content-Type for opensearch.xml#115
danielroe merged 1 commit intonpmx-dev:mainfrom
BYK:fix/opensearch-content-type

Conversation

@BYK
Copy link
Copy Markdown
Contributor

@BYK BYK commented Jan 26, 2026

Summary

Set the correct Content-Type header for the OpenSearch XML response to prevent Vercel from injecting preview toolbar scripts.

Follow up to #113.

Problem

Vercel's preview toolbar only injects scripts into responses with Content-Type: text/html. Without an explicit Content-Type, the XML response was being treated as HTML, causing:

  • Feedback script injection at the end of the XML
  • Invalid XML that browsers couldn't parse as an OpenSearch description

Solution

Add setHeader(event, 'Content-Type', 'application/opensearchdescription+xml') to the server route handler.

Set Content-Type to application/opensearchdescription+xml to prevent
Vercel from injecting preview toolbar scripts into the XML response.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 26, 2026

@BYK is attempting to deploy a commit to the danielroe Team on Vercel.

A member of the Team first needs to authorize it.

@BYK BYK marked this pull request as ready for review January 26, 2026 10:44
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jan 26, 2026 10:50am

Request Review

@danielroe
Copy link
Copy Markdown
Member

thank you! and sorry, it was my mistake!

@danielroe danielroe merged commit d193569 into npmx-dev:main Jan 26, 2026
7 of 8 checks passed
@BYK BYK deleted the fix/opensearch-content-type branch January 26, 2026 11:23
vinnymac pushed a commit to vinnymac/npmx.dev that referenced this pull request Jan 28, 2026
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.

2 participants