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.
		
			
				
	
	
		
			15 lines
		
	
	
		
			373 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			373 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package probeservices
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
 | 
						|
	"github.com/ooni/probe-cli/v3/internal/model"
 | 
						|
)
 | 
						|
 | 
						|
// GetTestHelpers is like GetCollectors but for test helpers.
 | 
						|
func (c Client) GetTestHelpers(
 | 
						|
	ctx context.Context) (output map[string][]model.OOAPIService, err error) {
 | 
						|
	err = c.APIClientTemplate.WithBodyLogging().Build().GetJSON(ctx, "/api/v1/test-helpers", &output)
 | 
						|
	return
 | 
						|
}
 |