-
Notifications
You must be signed in to change notification settings - Fork 27
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
All response headers are converted to string #118
Comments
Hi, can you provide a small reproduction please ? |
@Hebilicious sure thing, I'll get you a test project to look at by the end of this week |
@Hebilicious here's the repo, it's a heavily simplified version of the project I'm working on. I've included some comments on what it is and how it works in the readme: unjs-unenv-issue-118-demo. |
This is a bit off-topic/cross-project BUT if anyone else experiences similar issues with headers/cookies/base64 in a nuxt3 app built with the preset/entry.ts: import "#internal/nitro/virtual/polyfill";
import { toNodeListener } from "h3";
import serverless from "serverless-http";
const listener = toNodeListener(useNitroApp().h3App);
export const handler = serverless(listener, { provider: "aws" }); preset/nitro.config.ts: import type { NitroPreset } from "nitropack";
import { fileURLToPath } from "node:url";
export default <NitroPreset>{
extends: "node-server",
entry: fileURLToPath(new URL("./entry.ts", import.meta.url)),
}; nuxt.config.ts: nitro: {
preset: "./preset",
}, |
This seems to be intentional but it breaks compatibility with packages like node-oidc-provider that expect
response.getHeader()
to return the same data type as was passed toresponse.setHeader()
, which is what the node docs say should happen.For context, here's what happens in one of the projects I'm working on for a client. We're using nuxt3 deployed with the aws-lambda nitro preset. Several API routes pass ServerResponse instances from this framework to node-oidc-provider that sets multi-value set-cookie header in one module and reads it afterwards in another one. Since the original value is an array, it expects to receive an array back. Instead of that, it gets a comma-separated string and errors.
Relevant code is below. If this is the behaviour you're planning to keep, I'd appreciate a quick comment about that so I and everyone else who stumbles upon this issue can look into a workaround. Thanks :)
unenv/src/runtime/node/http/_response.ts
Line 98 in 82bdf72
The text was updated successfully, but these errors were encountered: