Skip to content

Commit

Permalink
fix: check for null data for stream detection (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 24, 2022
1 parent 18d5e42 commit 70f03fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function appendHeader (res: ServerResponse, name: string, value: string):
}

export function isStream (data: any) {
return typeof data === 'object' && typeof data.pipe === 'function' && typeof data.on === 'function'
return data && typeof data === 'object' && typeof data.pipe === 'function' && typeof data.on === 'function'
}

export function sendStream (res: ServerResponse, data: any) {
Expand Down

0 comments on commit 70f03fe

Please sign in to comment.