MCPcopy
hub / github.com/tinyhttp/tinyhttp / setContentType

Function setContentType

packages/res/src/headers.ts:84–90  ·  view source on GitHub ↗
(res: Response)

Source from the content-addressed store, hash-verified

82}
83
84export const setContentType = <Response extends Res = Res>(res: Response) => (type: string): Response => {
85 const ct = type.indexOf('/') === -1 ? mime.lookup(type) : type
86
87 setHeader(res)('Content-Type', ct)
88
89 return res
90}

Callers 3

extendMiddlewareFunction · 0.90
attachmentFunction · 0.90
res.test.tsFile · 0.90

Calls 1

setHeaderFunction · 0.85

Tested by

no test coverage detected