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:
@@ -20,7 +20,7 @@ func Control(
|
||||
}
|
||||
// make sure error is wrapped
|
||||
err = errorsxlegacy.SafeErrWrapperBuilder{
|
||||
Error: clnt.Build().PostJSON(ctx, resourcePath, creq, &out),
|
||||
Error: clnt.WithBodyLogging().Build().PostJSON(ctx, resourcePath, creq, &out),
|
||||
Operation: netxlite.TopLevelOperation,
|
||||
}.MaybeBuild()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user