veloze
Version:
A modern and fast express-like webserver for the web
36 lines (25 loc) • 921 B
Markdown
[◀︎ response/json](../response/json.md)
[🛖](../index.md)
[](../response/vary.md)
Set (multiple) headers on response.
If header value is set to `false` header is removed.
```ts
setHeaders(res: Response, headers?: Record<string, string|number|boolean>): void
```
| type | property | description |
| ---------------------------------------- | ---------- | ---------------------------- |
| Response | res | The response object |
| Record\<string, string\|number\|boolean> | \[headers] | Optional headers object |
```js
import { response } from 'veloze'
const { setHeaders } = response
setHeaders(res, {
'content-type': 'text/html; charset=utf-8',
'x-request-id': 'abcdef',
'content-length': false //< will be removed
})
```
---
[🔝 TOP](#top)