(ctx context.Context, rw http.ResponseWriter, status int, response interface{})
| 212 | } |
| 213 | |
| 214 | func WriteIndent(ctx context.Context, rw http.ResponseWriter, status int, response interface{}) { |
| 215 | _, span := tracing.StartSpan(ctx) |
| 216 | defer span.End() |
| 217 | |
| 218 | SetAuthzCheckRecorderHeader(ctx, rw) |
| 219 | |
| 220 | rw.Header().Set("Content-Type", "application/json; charset=utf-8") |
| 221 | rw.WriteHeader(status) |
| 222 | |
| 223 | enc := json.NewEncoder(rw) |
| 224 | enc.SetEscapeHTML(true) |
| 225 | enc.SetIndent("", "\t") |
| 226 | |
| 227 | // We can't really do much about these errors, it's probably due to a |
| 228 | // dropped connection. |
| 229 | _ = enc.Encode(response) |
| 230 | } |
| 231 | |
| 232 | // Read decodes JSON from the HTTP request into the value provided. It uses |
| 233 | // go-validator to validate the incoming request body. ctx is used for tracing |
no test coverage detected