Skip to content

service, vendor.SAP: add response_hook for pre-handler response inspection - #305

Merged
phanak-sap merged 1 commit into
masterfrom
alternative154
Jul 8, 2026
Merged

service, vendor.SAP: add response_hook for pre-handler response inspection#305
phanak-sap merged 1 commit into
masterfrom
alternative154

Conversation

@phanak-sap

Copy link
Copy Markdown
Contributor
  • Add an optional response_hook=None parameter to Service and Client

    response_hook fires inside _call_handler() before the domain handler runs, covering both execute() and async_execute(). The hook is a stateless Callable[[response], None]; raising from it propagates to the caller and suppresses the domain result. No HTTP networking objects cross the OData API boundary.

  • Add sap_header_error_hook() to pyodata.vendor.SAP

    reads the sap-message response header and raises BusinessGatewayError when severity is "error".

  • Update tests and documentation accordingly

@phanak-sapphanak-sap added the enhancement New feature or request label Jun 20, 2026
@phanak-sap
phanak-sapforce-pushed the alternative154 branch 3 times, most recently from 4d5ea9f to 50c425fCompareJune 20, 2026 13:11
…ction
- Add an optional response_hook=None parameter to Service and Client
response_hook fires inside _call_handler() before the domain handler runs,
covering both execute() and async_execute(). The hook is a stateless
Callable[[response], None]; raising from it propagates to the caller
and suppresses the domain result. No HTTP networking objects cross the OData
API boundary.
- Add sap_header_error_hook() to pyodata.vendor.SAP
reads the sap-message response header and raises BusinessGatewayError when
severity is "error".
- Update tests and documentation accordingly
@phanak-sap

phanak-sap commented Jun 20, 2026

Copy link
Copy Markdown
ContributorAuthor

Left as open question for reviewers:

  • does that cover the original use case that was workerounded elsewhere? Is it usable together with sapcli or anything else
  • is 1 hook only OK or bad and should it be instead be list of hooks with possibility to register multiple different stateless response hooks? The logic chaining can always be solved IMHO outside of pyodata and provide one hook only for enforced simplicity.

@phanak-sapphanak-sap mentioned this pull request Jun 20, 2026
@phanak-sap
phanak-sap removed the request for review from mnezerkaJuly 6, 2026 19:50
@filak-sap

Copy link
Copy Markdown
Contributor

Replaces the original PR #154

@phanak-sap
phanak-sap merged commit b5f7af5 into masterJul 8, 2026
54 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@phanak-sap@filak-sap