Conversation
update_entity() treated anything but 204 No Content as a failure. OData V2 answers a successful update with 204, but some services reply 200 OK instead; SAP SuccessFactors does so for PUT, so updates that had succeeded on the server raised HttpError on the client. Accept both 200 and 204, as the other request handlers already accept 200. Any other status still raises HttpError. Refs SAP#136 (the 200/204 part only; UPSERT and batch are separate)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #136, first point only:
update_entity()raisedHttpErrorfor a200 OKresponse.OData V2 answers a successful update with
204 No Content, but some services reply200 OKinstead. SAP SuccessFactors does this forPUT, so an update that had already succeeded on the server raisedHttpErroron the client. As @phanak-sap suggested in the issue, the handler now accepts200as well, like the other request handlers already do. Any other status still raisesHttpError.The UPSERT method and batch points of #136 are separate problems and are not touched here, so the issue should stay open.
Changes:
pyodata/v2/service.py:update_entity_handleracceptsHTTP_CODE_OKand a newHTTP_CODE_NO_CONTENTconstant.tests/test_service_v2.py:test_update_entity_accepts_ok_and_no_content(parametrized 200/204; the 200 case fails without the fix) andtest_update_entity_rejects_unexpected_status(400 still raises with the same message).CHANGELOG.md: Unreleased / Fixed entry.Checked locally:
pytest298 passed;pylint==2.8.310.00/10,flake8==3.8.4andbandit -lllclean onpyodata(Python 3.10, as in the lint workflow).