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(middleware): don't use headers.append(), use headers.set() #1129

Merged
merged 2 commits into from May 24, 2023

Conversation

yusukebe
Copy link
Member

Some middleware are using response.headers.append() when setting header values. With this method, it's possible to set duplicate values if the middleware is called twice.

app.use(
  '/api/*',
  cors({
    origin: 'http://example.com',
  })
)
app.use(
  '/api/*',
  cors({
    origin: 'http://example.com',
  })
)

In this PR, response.headers.set() is used to fix this issue.

@yusukebe yusukebe merged commit 8f5ba57 into main May 24, 2023
8 checks passed
@yusukebe yusukebe deleted the fix/dont-append-header-values branch May 24, 2023 09:01
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.

None yet

1 participant