Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): explicitly set content-type to text/html for requests to /api #610

Merged
merged 6 commits into from
Jul 18, 2024

Conversation

magurotuna
Copy link
Member

@magurotuna magurotuna commented Jul 18, 2024

This commit adds a custom middleware to overwrite content-type in the response header with text/html for all requests to /api except for CSS and JS.
This helps avoid the MIME type detection errors that happen with some file names such as Deno.Kv.prototype.list.

Fixes #609
Fixes #607


With the local dev server I confirmed that Deno.Kv.prototype.list is rendered correctly and content-type in the response header is set to text/html.

Deno.Kv.prototype.list works correctly on local

@magurotuna magurotuna changed the title fix(server): explicitly set content-type to text/html for all requests to /api fix(server): explicitly set content-type to text/html for requests to /api Jul 18, 2024
@magurotuna magurotuna force-pushed the magurotuna/content-type-for-api branch from e7ee20b to d751d30 Compare July 18, 2024 12:07
middleware.ts Outdated Show resolved Hide resolved
Copy link
Member

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crowlKats crowlKats merged commit 5de7af8 into denoland:main Jul 18, 2024
2 checks passed
@magurotuna magurotuna deleted the magurotuna/content-type-for-api branch July 18, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants