koajs / koajs/cors

https://github.com/koajs/cors/blob/master/index.js#L138

Open
#79 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
742
Forks
83
PR merge metrics
No merged PRs in 30d

Description

I got it :https://github.com/koajs/cors/blob/master/index.js#L138

_Originally posted by @slip-box in https://github.com/koajs/cors/issues/71#issuecomment-654097447_

allowHeaders don't proxy custom headers [1] to koa middleware. [2]

**[1]**
``` typescript
server.applyMiddleware({
app,
cors: {
allowHeaders: ['authorization'],
},
})
```

**[2]**
``` typescript
export const app = new Koa()
app.use(async (ctx, next) => {
ctx.req.headers.authorization // this is undefined
})
```

Contributor guide

Open the contributing guide

Research direction

Start at index.js around line 138 and trace how the allowHeaders option reaches the Koa middleware. Reproduce the example with the authorization header, then verify that custom headers are available through ctx.req.headers; add regression coverage for the reported behavior if the repository's existing tests provide a suitable entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.