mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
<picture data-single-emoji=":pnpm:" title=":pnpm:"><img class="emoji" src="https://single-emoji.vercel.app/api/emoji/eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..4mJzrO94AnSn0Pue.4apgaKtTUdQ-wxNyahjdJj28u8bbXreLoTA8AGqYjLta3MrsFvbo9DsQFth4CoIkBgXFhQ5_BVcKNfYbwLg4bKzyIvItKe4OFS8AzG7Kkicz2kUUZk0.nXyK_PvHzZFGA-MQB6XHfA" alt=":pnpm:" width="20" height="auto" align="absmiddle"></picture> yarn has become increasingly more difficult to use as the v1 we rely on no longer receives updates. pnpm is faster and is actively maintained. This PR migrates us to pnpm.
39 lines
928 B
Markdown
39 lines
928 B
Markdown
# Interface: ModifiedRequest
|
|
|
|
## Table of contents
|
|
|
|
### Properties
|
|
|
|
- [headers](ModifiedRequest.md#headers)
|
|
|
|
## Properties
|
|
|
|
### headers
|
|
|
|
• `Optional` **headers**: `Headers`
|
|
|
|
If set, overwrites the incoming headers to the origin request.
|
|
|
|
This is useful when you want to pass data between a Middleware and a
|
|
Serverless or Edge Function.
|
|
|
|
**`Example`**
|
|
|
|
<caption>Add a `x-user-id` header and remove the `Authorization` header</caption>
|
|
|
|
```ts
|
|
import { rewrite } from '@vercel/edge';
|
|
export default async function middleware(request: Request): Promise<Response> {
|
|
const newHeaders = new Headers(request.headers);
|
|
newHeaders.set('x-user-id', 'user_123');
|
|
newHeaders.delete('authorization');
|
|
return rewrite(request.url, {
|
|
request: { headers: newHeaders },
|
|
});
|
|
}
|
|
```
|
|
|
|
#### Defined in
|
|
|
|
[packages/edge/src/middleware-helpers.ts:23](https://github.com/vercel/vercel/blob/main/packages/edge/src/middleware-helpers.ts#L23)
|