-
Notifications
You must be signed in to change notification settings - Fork 43
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
Content-Type is changed to text/html and script tag is inserted #39
Comments
It shouldn't change this if encoding is set to anything non-html will check this asap and post any updates here |
Thanks for the check. I will consider not using Express |
Wait, why can't this be fixed? I've run into this too. @hankei6km is using |
I didn't look too deeply into this but seeing that it is using res.json it's probably something going wrong in nodebox, reopening this ticket |
I've already stopped using Express on Nodebox and am using another method. So I can't contribute much. However, Additional information that may be helpful if you look deeper This is a forked sandbox from example. https://codesandbox.io/p/sandbox/reproduce-content-type-markdown-nodebox-drv44h I added only one line to res.setHeader('content-type', 'text/makdown'); But in Nodebox it is text/html. Of course, when I run it with native Node.js, it is Therefore, similar problems may occur outside of |
I am sending JSON using
res.json
in Express. In this caseContent-Type
of res headers should beapplication/json
.But in Nodebox Runtime it is changed to
text/html
.And
<script>
tag is inserted.step to reproduce
A sandbox for step to reproduce.
https://codesandbox.io/p/sandbox/reproduce-btoken-json-responce-fohukt
Server part code:
https://codesandbox.io/p/sandbox/reproduce-content-type-is-changed-to-text-html-fohukt?file=%2Fbox-src%2Fvite-project%2Fserver.js%3A1%2C1
Express + Vite server is started inside the Nodebox environment and fetch the JSON from the preview window.
This will result in a parse error.
Start the above server without using Nodebox with
npm run server
.This is displayed as expected.
The text was updated successfully, but these errors were encountered: