MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / copyJSONToWriter

Function copyJSONToWriter

diagnostic/client.go:185–205  ·  view source on GitHub ↗
(response *http.Response, writer io.Writer)

Source from the content-addressed store, hash-verified

183}
184
185func copyJSONToWriter(response *http.Response, writer io.Writer) error {
186 defer response.Body.Close()
187
188 var data interface{}
189
190 decoder := json.NewDecoder(response.Body)
191
192 err := decoder.Decode(&data)
193 if err != nil {
194 return fmt.Errorf("diagnostic client error whilst reading response: %w", err)
195 }
196
197 encoder := newFormattedEncoder(writer)
198
199 err = encoder.Encode(data)
200 if err != nil {
201 return fmt.Errorf("diagnostic client error whilst writing json: %w", err)
202 }
203
204 return nil
205}
206
207type HTTPClient interface {
208 GetLogConfiguration(ctx context.Context) (*LogConfiguration, error)

Callers 3

GetSystemInformationMethod · 0.85
GetCliConfigurationMethod · 0.85

Calls 5

newFormattedEncoderFunction · 0.85
ErrorfMethod · 0.80
CloseMethod · 0.65
DecodeMethod · 0.45
EncodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…