Files
vercel/packages/edge/docs/interfaces/ModifiedRequest.md
Ethan Arrowood 9c768b98b7 [tests] Migrate from yarn to pnpm (#9198)
<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.
2023-01-11 23:35:13 +00:00

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)