Skip to content

Commit

Permalink
chore: remove bad null check (#946)
Browse files Browse the repository at this point in the history
typeof null is 'object'
  • Loading branch information
dyladan authored Apr 8, 2020
1 parent 083b2d6 commit b43ac51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/opentelemetry-plugin-http/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ export const parseResponseStatus = (
* Returns whether the Expect header is on the given options object.
* @param options Options for http.request.
*/
export const hasExpectHeader = (options: RequestOptions | url.URL): boolean => {
if (typeof (options as RequestOptions).headers !== 'object') {
export const hasExpectHeader = (options: RequestOptions): boolean => {
if (!options.headers) {
return false;
}

const keys = Object.keys((options as RequestOptions).headers!);
const keys = Object.keys(options.headers);
return !!keys.find(key => key.toLowerCase() === 'expect');
};

Expand Down

0 comments on commit b43ac51

Please sign in to comment.