Add 413 as a possible response for /config/import

This commit is contained in:
Joe Kralicky 2024-09-19 15:33:15 -04:00
parent 4791a4cb98
commit f4a35731cb
No known key found for this signature in database
GPG key ID: 75C4875F34A9FB79
4 changed files with 36 additions and 0 deletions

View file

@ -697,6 +697,7 @@ type ImportConfigurationResp struct {
Body []byte
HTTPResponse *http.Response
JSON400 *ErrorResponse
JSON413 *ErrorResponse
JSON500 *ErrorResponse
}
@ -1064,6 +1065,13 @@ func ParseImportConfigurationResp(rsp *http.Response) (*ImportConfigurationResp,
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 413:
var dest ErrorResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON413 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest ErrorResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {