mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
Log response. Fix #116
This commit is contained in:
+11
-11
@@ -71,6 +71,17 @@ func retryRequest(ctx context.Context, reqFunc func(context.Context, string) (*r
|
||||
resp, err := retryClient.Do(req)
|
||||
end := time.Now()
|
||||
|
||||
audit.LogAPIRoundTrip(audit.APIRequestSpan{
|
||||
RequestId: request_context.GetFromContext(ctx).RequestId,
|
||||
Response: resp,
|
||||
Error: err,
|
||||
Method: req.Method,
|
||||
Token: tokenValue,
|
||||
Body: "",
|
||||
StartTime: start,
|
||||
EndTime: end,
|
||||
})
|
||||
|
||||
if err == nil && resp.StatusCode == http.StatusOK {
|
||||
if userToken == "" && !isPost {
|
||||
tokenManager.MarkTokenStatus(token, token_manager.Good)
|
||||
@@ -95,17 +106,6 @@ func retryRequest(ctx context.Context, reqFunc func(context.Context, string) (*r
|
||||
tokenManager.MarkTokenStatus(token, token_manager.TimedOut)
|
||||
}
|
||||
|
||||
audit.LogAPIRoundTrip(audit.APIRequestSpan{
|
||||
RequestId: request_context.GetFromContext(ctx).RequestId,
|
||||
Response: resp,
|
||||
Error: err,
|
||||
Method: req.Method,
|
||||
Token: tokenValue,
|
||||
Body: "",
|
||||
StartTime: start,
|
||||
EndTime: end,
|
||||
})
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return SimpleHTTPResponse{}, ctx.Err()
|
||||
|
||||
Reference in New Issue
Block a user