Refactor to TypeScript ES modules and add metadata sidebar
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { Response } from 'express-serve-static-core'
|
||||
import { getConfigOption } from './config/access'
|
||||
|
||||
/**
|
||||
* Apply the response headers configured under `ipp.responseHeaders` to the
|
||||
* given Response. Used by route handlers to attach the default Cache-Control
|
||||
* and CORS values from `config.json`.
|
||||
*/
|
||||
export function addResponseHeaders (res: Response): void {
|
||||
Object.entries(getConfigOption('ipp.responseHeaders', {}) as { [key: string]: string })
|
||||
.forEach(([header, value]) => {
|
||||
res.set(header, value)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user