Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
fix: make header check case insensitive (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
pevisscher authored Sep 27, 2022
1 parent 4340064 commit aa45ff8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/start/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export async function handler(argv: ReturnType<typeof builder>['argv']): Promise
res.set(header, val.toString())
}
res.status(result.statusCode)
if (result.headers?.['content-type'].toString()?.includes('json') === true) {
if (
Object.entries(result.headers ?? {})
.find(([header]) => header.toLowerCase() === 'content-type')?.[1]
?.toString()
?.includes('json') === true
) {
res.json(JSON.parse(result.body))
} else {
res.send(result.body)
Expand Down

0 comments on commit aa45ff8

Please sign in to comment.