Skip to content

Commit

Permalink
♻️ Refactored to save 8 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukecarr committed Nov 18, 2021
1 parent a7586a4 commit 1886edb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export const mime = 'application/problem+json'
* @param err The error details to send.
*/
export function withError (res: ServerResponse, err: Partial<Error>): void {
if (typeof err.status !== 'undefined') {
res.statusCode = err.status
}
err.status && (res.statusCode = err.status)
return res.setHeader('Content-Type', mime).end(JSON.stringify(err))
}

Expand Down

0 comments on commit 1886edb

Please sign in to comment.