feat(httpx): implement optional body logging also on http error (#651)
1. we want optionally to log the body (we don't want to log the body when we're fetching psiphon secrets or tor targets) 2. we want body logging to _also_ happen on error since this is quite useful to debug possible errors when accessing the API This diff adds the above functionality, which were previously described in https://github.com/ooni/probe/issues/1951. This diff also adds comprehensive testing.
This commit is contained in:
parent
ee0aa18616
commit
dba861d262
13 changed files with 229 additions and 17 deletions
|
|
@ -28,7 +28,7 @@ func (c Client) FetchURLList(ctx context.Context, config model.OOAPIURLListConfi
|
|||
query.Set("category_codes", strings.Join(config.Categories, ","))
|
||||
}
|
||||
var response urlListResult
|
||||
err := c.APIClientTemplate.Build().GetJSONWithQuery(ctx,
|
||||
err := c.APIClientTemplate.WithBodyLogging().Build().GetJSONWithQuery(ctx,
|
||||
"/api/v1/test-list/urls", query, &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue