We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8bb186 commit df5e92bCopy full SHA for df5e92b
src/utils.ts
@@ -6,13 +6,15 @@ export const MIMES = {
6
json: 'application/json'
7
}
8
9
-export function send (res: ServerResponse, data: string, type: string) {
10
- defaultContentType(res, type)
+export function send (res: ServerResponse, data: any, type?: string) {
+ if (type) {
11
+ defaultContentType(res, type)
12
+ }
13
res.end(data)
14
15
-export function defaultContentType (res: ServerResponse, type: string) {
- if (!res.getHeader('Content-Type')) {
16
+export function defaultContentType (res: ServerResponse, type?: string) {
17
+ if (type && !res.getHeader('Content-Type')) {
18
res.setHeader('Content-Type', type)
19
20
0 commit comments