Skip to content

service: accept 200 OK as a successful update_entity response - #316

Merged
filak-sap merged 1 commit into
SAP:masterfrom
kosesena:fix/136-update-entity-accept-200
Sep 29, 2026
Merged

filak-sap merged 1 commit into
SAP:masterfrom
kosesena:fix/136-update-entity-accept-200

Conversation

@kosesena

Copy link
Copy Markdown
Contributor

Refs #136, first point only: update_entity() raised HttpError for a 200 OK response.

OData V2 answers a successful update with 204 No Content, but some services reply 200 OK instead. SAP SuccessFactors does this for PUT, so an update that had already succeeded on the server raised HttpError on the client. As @phanak-sap suggested in the issue, the handler now accepts 200 as well, like the other request handlers already do. Any other status still raises HttpError.

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_handler accepts HTTP_CODE_OK and a new HTTP_CODE_NO_CONTENT constant.
  • tests/test_service_v2.py: test_update_entity_accepts_ok_and_no_content (parametrized 200/204; the 200 case fails without the fix) and test_update_entity_rejects_unexpected_status (400 still raises with the same message).
  • CHANGELOG.md: Unreleased / Fixed entry.

Checked locally: pytest 298 passed; pylint==2.8.3 10.00/10, flake8==3.8.4 and bandit -lll clean on pyodata (Python 3.10, as in the lint workflow).

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)
@filak-sap

Copy link
Copy Markdown
Contributor

Thank you!

@filak-sap
filak-sap merged commit 33072b8 into SAP:master Sep 29, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants