[18.0][FIX] webservice: always return the full response, drop content_only - #167
Merged
Merged
Conversation
Contributor
|
Hi @etobella, |
Ricardoalso
reviewed
Sep 23, 2026
simahawk
force-pushed
the
18-fix-content-only
branch
from
September 23, 2026 12:21
4a62d8d to
38ee62a
Compare
`_request()` defaulted `content_only` to `True`, silently returning raw bytes instead of the `requests.Response` object callers expect. The OAuth2 backend adapter ignored the flag entirely, always returning bytes (fixes OCA#142). OCA#144 fixes the OAuth2 inconsistency but keeps `content_only` as a kwarg (default `None`, warns, still defaults to `True`) - perpetuating the actual problem: the return type shouldn't be a per-call switch, especially when raw content is just `.response.content` away. Here, `_request()` always returns the full response; the kwarg is dropped (a stray one is popped and warned about, not left to crash inside `requests.request()`). Backward compat is handled once, at the database level: the `18.0.2.0.1` upgrade script sets a `webservice.request_content_only` system parameter on existing databases only, preserving old behavior for calling code that relied on the implicit default. Delete the parameter to switch to the new behavior. The compat switch lives in `webservice`, not `webservice_core`: the latter is new and unreleased, so its `_request()` stays simple with no compat baggage.
simahawk
force-pushed
the
18-fix-content-only
branch
from
September 23, 2026 12:26
38ee62a to
df5cde7
Compare
simahawk
marked this pull request as ready for review
September 23, 2026 12:28
Contributor
Author
|
/ocabot merge patch |
Contributor
|
This PR looks fantastic, let's merge it! |
Contributor
|
Congratulations, your PR was merged at e554d39. Thanks a lot for contributing to OCA. ❤️ |
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.
_request()defaultedcontent_onlytoTrue, silently returning rawbytes instead of the
requests.Responseobject callers expect. TheOAuth2 backend adapter ignored the flag entirely, always returning
bytes (fixes #142).
#144 fixes the OAuth2 inconsistency but keeps
content_onlyas akwarg (default
None, warns, still defaults toTrue) - perpetuatingthe actual problem: the return type shouldn't be a per-call switch,
especially when raw content is just
.response.contentaway.Here,
_request()always returns the full response; the kwarg isdropped (a stray one is popped and warned about, not left to crash
inside
requests.request()). Backward compat is handled once, at thedatabase level: the
18.0.2.0.1upgrade script sets awebservice.request_content_onlysystem parameter on existingdatabases only, preserving old behavior for calling code that relied on
the implicit default. Delete the parameter to switch to the new
behavior.
The compat switch lives in
webservice, notwebservice_core: thelatter is new and unreleased, so its
_request()stays simple with nocompat baggage.