@@ -284,7 +284,8 @@ func (a *API) DoRequestByAlias(apiAlias string, ipTypeRequired protocolTypes.Req
284
284
}
285
285
}
286
286
287
- return a .requestRaw (ipTypeRequired , alias .host , alias .path , "" , "" , nil , 0 , 0 )
287
+ responseData , _ , err = a .requestRaw (ipTypeRequired , alias .host , alias .path , "" , "" , nil , 0 , 0 )
288
+ return responseData , err
288
289
}
289
290
290
291
// SessionNew - try to register new session
@@ -310,7 +311,7 @@ func (a *API) SessionNew(accountID string, wgPublicKey string, kemKeys types.Kem
310
311
Captcha : captcha ,
311
312
Confirmation2FA : confirmation2FA }
312
313
313
- data , err := a .requestRaw (protocolTypes .IPvAny , "" , _sessionNewPath , "POST" , "application/json" , request , 0 , 0 )
314
+ data , httpResp , err := a .requestRaw (protocolTypes .IPvAny , "" , _sessionNewPath , "POST" , "application/json" , request , 0 , 0 )
314
315
if err != nil {
315
316
return nil , nil , nil , rawResponse , err
316
317
}
@@ -319,7 +320,7 @@ func (a *API) SessionNew(accountID string, wgPublicKey string, kemKeys types.Kem
319
320
320
321
// Check is it API error
321
322
if err := json .Unmarshal (data , & apiErr ); err != nil {
322
- return nil , nil , nil , rawResponse , fmt .Errorf ("failed to deserialize API response: %w" , err )
323
+ return nil , nil , nil , rawResponse , fmt .Errorf ("[%d; status=%s] failed to deserialize API response: %w" , httpResp . StatusCode , httpResp . Status , err )
323
324
}
324
325
325
326
// success
@@ -353,7 +354,7 @@ func (a *API) SessionStatus(session string) (
353
354
354
355
request := & types.SessionStatusRequest {Session : session }
355
356
356
- data , err := a .requestRaw (protocolTypes .IPvAny , "" , _sessionStatusPath , "POST" , "application/json" , request , 0 , 0 )
357
+ data , _ , err := a .requestRaw (protocolTypes .IPvAny , "" , _sessionStatusPath , "POST" , "application/json" , request , 0 , 0 )
357
358
if err != nil {
358
359
return nil , nil , err
359
360
}
@@ -442,7 +443,7 @@ func (a *API) GeoLookup(timeoutMs int, ipTypeRequired protocolTypes.RequiredIPPr
442
443
gl .isRunning = false
443
444
close (gl .done )
444
445
}()
445
- gl .response , gl .err = a .requestRaw (ipType , "" , _geoLookupPath , "GET" , "" , nil , timeoutMs , 0 )
446
+ gl .response , _ , gl .err = a .requestRaw (ipType , "" , _geoLookupPath , "GET" , "" , nil , timeoutMs , 0 )
446
447
if err := json .Unmarshal (gl .response , & gl .location ); err != nil {
447
448
gl .err = fmt .Errorf ("failed to deserialize API response: %w" , err )
448
449
}
0 commit comments