readSanitizeJSONInto reads and sanitizes a JSON request body and returns raw bytes and DbConfig. Expands environment variables (if any) referenced in the config.
()
| 1385 | // readSanitizeJSONInto reads and sanitizes a JSON request body and returns raw bytes and DbConfig. |
| 1386 | // Expands environment variables (if any) referenced in the config. |
| 1387 | func (h *handler) readSanitizeDbConfigJSON() ([]byte, *DbConfig, error) { |
| 1388 | var config DbConfig |
| 1389 | rawBytes, err := h.readSanitizeJSON(&config) |
| 1390 | if err != nil { |
| 1391 | if errors.Cause(base.WrapJSONUnknownFieldErr(err)) == base.ErrUnknownField { |
| 1392 | err = base.HTTPErrorf(http.StatusBadRequest, "JSON Unknown Field: %s", err.Error()) |
| 1393 | } |
| 1394 | } |
| 1395 | return rawBytes, &config, err |
| 1396 | } |
| 1397 | |
| 1398 | // Reads & parses the request body, handling either JSON or multipart. |
| 1399 | func (h *handler) readDocument() (db.Body, error) { |
no test coverage detected