File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -905,14 +905,14 @@ Object.setPrototypeOf(normalizedMethodRecordsBase, null)
905905Object . setPrototypeOf ( normalizedMethodRecords , null )
906906
907907/**
908- * @param {Record<string, string | string[]> | Iterable<[string, string]> | string[] }
908+ * @param {Record<string, string | string[]> | Iterable<[string, string]> | string[] } opts
909909 * @returns {Record<string, string[] | string> }
910910 */
911911function normalizeHeaders ( opts ) {
912912 const headers = { }
913913 const src = opts . headers
914914
915- if ( src == null ) return headers
915+ if ( typeof src !== 'object' || src = == null ) return headers
916916
917917 if ( Array . isArray ( src ) ) {
918918 for ( let i = 0 ; i < src . length ; i += 2 ) {
@@ -934,12 +934,10 @@ function normalizeHeaders (opts) {
934934 return headers
935935 }
936936
937- if ( typeof src === 'object' ) {
938- for ( const key of Object . keys ( src ) ) headers [ key . toLowerCase ( ) ] = src [ key ]
939- return headers
937+ for ( const key of Object . keys ( src ) ) {
938+ headers [ key . toLowerCase ( ) ] = src [ key ]
940939 }
941-
942- throw new InvalidArgumentError ( 'opts.headers is not an object' )
940+ return headers
943941}
944942
945943module . exports = {
You can’t perform that action at this time.
0 commit comments