File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,12 @@ import type { FileInfo } from "../types/index.js";
66export  const  sendRequest  =  async  ( { 
77  init, 
88  redirects =  [ ] , 
9+   timeout =  60_000 , 
910  url, 
1011} : { 
1112  init ?: RequestInit ; 
1213  redirects ?: string [ ] ; 
14+   timeout ?: number ; 
1315  url : URL  |  string ; 
1416} ) : Promise < { 
1517  response : Response ; 
@@ -21,14 +23,19 @@ export const sendRequest = async ({
2123    const  controller  =  new  AbortController ( ) ; 
2224    const  timeoutId  =  setTimeout ( ( )  =>  { 
2325      controller . abort ( ) ; 
24-     } ,  60_000 ) ; 
26+     } ,  timeout ) ; 
2527    const  response  =  await  fetch ( url ,  { 
2628      signal : controller . signal , 
2729      ...init , 
2830    } ) ; 
2931    clearTimeout ( timeoutId ) ; 
3032
3133    if  ( response . status  >=  400 )  { 
34+       // gracefully handle HEAD method not allowed 
35+       if  ( response . status  ===  405  &&  init ?. method  ===  'HEAD' )  { 
36+         return  {  response } ; 
37+       } 
38+ 
3239      throw  ono ( {  status : response . status  } ,  `HTTP ERROR ${ response . status }  ) ; 
3340    } 
3441
@@ -49,6 +56,7 @@ export const sendRequest = async ({
4956      return  sendRequest ( { 
5057        init, 
5158        redirects, 
59+         timeout, 
5260        url : resolve ( url . href ,  response . headers . location  as  string ) , 
5361      } ) ; 
5462    } 
Original file line number Diff line number Diff line change 11{
22  "name" : " @hey-api/json-schema-ref-parser" 
3-   "version" : " 0.0.2 " 
3+   "version" : " 0.0.3 " 
44  "description" : " Parse, Resolve, and Dereference JSON Schema $ref pointers" 
55  "homepage" : " https://heyapi.dev/" 
66  "repository" : {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments