Skip to content

Bug 2072305 - Accept query-string params on Component create/update - #2750

Open
Xzzz wants to merge 2 commits into
mozilla:masterfrom
Xzzz:bug-2072305
Open

Xzzz wants to merge 2 commits into
mozilla:masterfrom
Xzzz:bug-2072305

Conversation

@Xzzz

@Xzzz Xzzz commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Component.pm's create/update only read parameters from the JSON POST/PUT body. Adds the query-string merge that the REST docs promise (query string overrides the body on a key collision), reusing the same merge_request_params helper as bugs 2065171/2065173, and fixes a stray-key crash in update()'s set_all() call that this change would otherwise expose.

Changes

  • Add Bugzilla::WebService::Util::merge_request_params (third copy of this helper across open PRs -- will collapse to one once 2065171 or 2065173 merges)
  • Component.pm create/update: query string + JSON body merge instead of JSON-body-only; drop the now-unused _get_params
  • Component.pm update(): whitelist the 8 documented update fields before set_all(), since form-urlencoded cookie-auth requests (which include Bugzilla_api_token) will now actually reach it instead of failing JSON parsing first
  • qa/t/rest_components.t: cover query-string-only create and query-string-overrides-body update

Test plan

  • POST /rest/component/Firefox with fields entirely in the query string, no JSON body
  • PUT /rest/component/Firefox/ with a query-string field overriding a JSON-body field
  • Existing qa/t/rest_components.t cases unaffected

References

create/update only read from the JSON body. Adds the query-string merge the docs promise, reusing
the same merge_request_params helper as bugs 2065171/2065173. update() now whitelists fields
before set_all(), since form-urlencoded cookie-auth requests (which include Bugzilla_api_token)
previously failed JSON parsing before reaching it and no longer will.
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.

1 participant