Skip to content

[18.0][FIX] webservice: always return the full response, drop content_only - #167

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
camptocamp:18-fix-content-only
Sep 23, 2026
Merged

OCA-git-bot merged 1 commit into
OCA:18.0from
camptocamp:18-fix-content-only

Conversation

@simahawk

@simahawk simahawk commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

_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 #142).

#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.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @etobella,
some modules you are maintaining are being modified, check this out!

Comment thread webservice/__manifest__.py
`_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
simahawk marked this pull request as ready for review September 23, 2026 12:28

@Ricardoalso Ricardoalso left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@simahawk

Copy link
Copy Markdown
Contributor Author

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-167-by-simahawk-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 13d0c1a into OCA:18.0 Sep 23, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at e554d39. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open Concern about webservice module defaulting content_only to True in "base.requests"

3 participants