diff options
author | Ed Tanous <edtanous@google.com> | 2021-03-24 18:23:03 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-03-29 19:20:15 +0300 |
commit | 4df1bee0bdc9d71043b51872875d3d22b26ab68f (patch) | |
tree | 2b408a551608368dd000e74f0062aaa5fe4ddd5a /redfish-core/src/error_messages.cpp | |
parent | 55b695f25ae80f35d00596c9a62324378310b9a2 (diff) | |
download | bmcweb-4df1bee0bdc9d71043b51872875d3d22b26ab68f.tar.xz |
Add OData-version header
From the redfish specification:
Redfish Services shall process the OData-Version header in the
following table as defined by the HTTP 1.1 specification.
<Table omitted, but shows "yes" for service requirements>
Services shall reject requests that specify an unsupported OData
version.
This code implements compliance with those two statements.
Tested:
curl -vvvv --insecure --user root:0penBmc -H "OData-Version: 4.1" https://<ip>/redfish/v1
Returns 412 Precondition Failed
curl -vvvv --insecure --user root:0penBmc -H "OData-Version: 4.0" https://<ip>/redfish/v1
returns 200
curl -vvvv --insecure --user root:0penBmc https://<ip>/redfish/v1
returns 200
The equivalent Redfish-Protocol-Validator tests now pass
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I50350b913f17ae35588e2f0606c56164f00dc2a9
Diffstat (limited to 'redfish-core/src/error_messages.cpp')
-rw-r--r-- | redfish-core/src/error_messages.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp index cfbc9c23fd..7059a3845b 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -972,7 +972,7 @@ nlohmann::json preconditionFailed(void) void preconditionFailed(crow::Response& res) { - res.result(boost::beast::http::status::bad_request); + res.result(boost::beast::http::status::precondition_failed); addMessageToErrorJson(res.jsonValue, preconditionFailed()); } |