Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E: improve beacon api logging #12211

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions testing/endtoend/evaluators/beaconapi_evaluators/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ func doMiddlewareJSONGetRequest(template string, requestPath string, beaconNodeI
return err
}
if httpResp.StatusCode != http.StatusOK {
return fmt.Errorf("request failed with response code: %d", httpResp.StatusCode)
var body interface{}
if err := json.NewDecoder(httpResp.Body).Decode(&body); err != nil {
return err
}
return fmt.Errorf("request failed with response code: %d with response body %s", httpResp.StatusCode, body)
}
return json.NewDecoder(httpResp.Body).Decode(&dst)
}
Expand Down Expand Up @@ -63,7 +67,11 @@ func doMiddlewareSSZGetRequest(template string, requestPath string, beaconNodeId
return nil, err
}
if rsp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("request failed with response code: %d", rsp.StatusCode)
var body interface{}
if err := json.NewDecoder(rsp.Body).Decode(&body); err != nil {
return nil, err
}
return nil, fmt.Errorf("request failed with response code: %d with response body %s", rsp.StatusCode, body)
}
defer closeBody(rsp.Body)
body, err := io.ReadAll(rsp.Body)
Expand Down Expand Up @@ -100,7 +108,11 @@ func doMiddlewareJSONPostRequest(template string, requestPath string, beaconNode
return err
}
if httpResp.StatusCode != http.StatusOK {
return fmt.Errorf("request failed with response code: %d", httpResp.StatusCode)
var body interface{}
if err := json.NewDecoder(httpResp.Body).Decode(&body); err != nil {
return err
}
return fmt.Errorf("request failed with response code: %d with response body %s", httpResp.StatusCode, body)
}
return json.NewDecoder(httpResp.Body).Decode(&dst)
}
Expand Down