Actions
Bug #38439
openISE when incorrect content-type used for organization creation through API
Description
Description of problem:
When I use an API call to create an organization and I specify an existing, but incorrect content-type (or I don't specify any at all), the call returns 500 Internal Server Error.
Steps to Reproduce:
1.
curl -uadmin:changeme -H 'Content-Type: application/json' -X POST https://$(hostname)/api/organizations -d '{"organization": {"name": "test1"}}'
{"select_all_types":[],"description":null,"created_at":"2023-08-03 10:51:04 UTC"
[...]
2.
curl -uadmin:changeme -H 'Content-Type: text/html' -X POST https://$(hostname)/api/organizations -d '{"organization": {"name": "test2"}}'
{
"error":
{"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."}
}
3.
curl -uadmin:changeme -H 'Content-Type: text/html' -X POST https://$(hostname)/api/locations -d '{"location": {"name": "test3"}}'
{
"error":
{"message":"Media type in 'Content-Type: text/html' is unsupported in API v2 for POST and PUT requests. Please use 'Content-Type: application/json'."}
}
Actual results:
For correct content-type, the organization is created. For incorrect type on a location endpoint, a location is not created and the error is handled correctly. For incorrect type on an organization endpoint, ISE happens.
Expected results:
The same behavior as for location.
Updated by The Foreman Bot 8 days ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/10548 added
Actions