(ctx context.Context, url string, headers []Header, body []byte, )
| 36 | } |
| 37 | |
| 38 | func (j *JSONHTTPClient) httpPutCSV(ctx context.Context, url string, |
| 39 | headers []Header, body []byte, |
| 40 | ) (*http.Response, []byte, error) { |
| 41 | req, err := makeTextCSVPutRequest(ctx, url, headers, body) |
| 42 | if err != nil { |
| 43 | return nil, nil, err |
| 44 | } |
| 45 | |
| 46 | correlationId := uuid.Must(uuid.NewRandom()).String() |
| 47 | |
| 48 | if logging.IsVerboseLogging(ctx) { |
| 49 | logRequestWithBody(logging.VerboseLogger(ctx), req, "PUT", correlationId, url, body) |
| 50 | } else { |
| 51 | logRequestWithoutBody(logging.Logger(ctx), req, "PUT", correlationId, url) |
| 52 | } |
| 53 | |
| 54 | rsp, body, err := j.HTTPClient.sendRequest(req) |
| 55 | |
| 56 | if logging.IsVerboseLogging(ctx) { |
| 57 | logResponseWithBody(logging.VerboseLogger(ctx), rsp, "PUT", correlationId, url, body) |
| 58 | } else { |
| 59 | logResponseWithoutBody(logging.Logger(ctx), rsp, "PUT", correlationId, url) |
| 60 | } |
| 61 | |
| 62 | if err != nil { |
| 63 | logging.Logger(ctx).Error("HTTP request failed", |
| 64 | "method", "PUT", "url", url, |
| 65 | "correlationId", correlationId, "error", err) |
| 66 | |
| 67 | return nil, nil, err |
| 68 | } |
| 69 | |
| 70 | return rsp, body, nil |
| 71 | } |
| 72 | |
| 73 | func makeTextCSVPutRequest(ctx context.Context, url string, headers []Header, body []byte) (*http.Request, error) { |
| 74 | req, err := http.NewRequestWithContext(ctx, http.MethodPut, url, bytes.NewReader(body)) |
no test coverage detected