File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -197,9 +197,15 @@ async function fetch(_options){
197
197
if ( this . options . verbose ) console . info ( "Added token to request:" , this . sessionToken )
198
198
}
199
199
200
+ // Définir un controller pour pouvoir timeout la requête
201
+ var controller = new AbortController ( )
202
+ if ( ! options . signal ) options . signal = controller . signal
203
+ var controllerTimeout = setTimeout ( ( ) => controller . abort ( ) , 7000 )
204
+
200
205
// Faire la requête
201
206
var response = await _fetch ( url , options ) . catch ( ( ) => { } )
202
207
if ( this . options . verbose ) console . info ( "Fetched:" , response . status , response . statusText )
208
+ clearTimeout ( controllerTimeout ) // On enlève le timeout
203
209
204
210
// Si la requête a échoué
205
211
if ( ! response ?. ok ) {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " freebox-wrapper" ,
3
- "version" : " 1.0.3 " ,
3
+ "version" : " 1.0.4 " ,
4
4
"description" : " Un wrapper pour l'API de Freebox OS, gère la connexion et facilite les requêtes." ,
5
5
"main" : " index.js" ,
6
6
"keywords" : [
You can’t perform that action at this time.
0 commit comments