Skip to content

Bug 2072313 - Accept query-string params on Reminders add - #2751

Merged
dklawren merged 7 commits into
mozilla:masterfrom
Xzzz:bug-2072313
Sep 23, 2026
Merged

dklawren merged 7 commits into
mozilla:masterfrom
Xzzz:bug-2072313

Conversation

@Xzzz

@Xzzz Xzzz commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reminders.pm's add() only read parameters from the JSON POST body. Adds the query-string merge that the REST docs promise, reusing the same merge_request_params helper as bugs 2065171/2065173/2072305.

Depends on 2072305 per the bug dependency (both introduce the same shared helper; will collapse to one copy once either merges).

Changes

  • merge_request_params now returns ($params, $error) instead of a bare hashref, so a request body that fails to decode as JSON is reported back as rest_malformed_json rather than silently ignored
  • merge_request_params: build params from $c->req->params->names/param() instead of ->to_hash, so a repeated query-string key (e.g. ?note=a&note=b) collapses to a scalar instead of an arrayref reaching an unvalidated field
  • Reminders.pm add(): query string + JSON body merge instead of JSON-body-only; returns user_error('rest_malformed_json') if the body doesn't decode
  • qa/t/rest_reminders.t: cover query-string-only reminder creation and malformed-JSON-body rejection

Test plan

  • POST /rest/reminder with bug_id/note/reminder_ts entirely in the query string, no JSON body
  • POST /rest/reminder with a truncated JSON body, expect 400 / rest_malformed_json
  • Existing qa/t/rest_reminders.t cases unaffected

References

  • Bugzilla link: 2072313
  • Depends on 2072305
  • Fixes 2072318: malformed-JSON bodies are now correctly reported via rest_malformed_json instead of being silently treated as empty params

add() only read from the JSON body. Reuse the same merge_request_params helper as
bugs 2065171/2065173/2072305 instead of writing another copy. No whitelist needed here:
create() only reads three named keys, not the whole params hash.
Comment thread Bugzilla/WebService/Util.pm Outdated
Comment thread Bugzilla/WebService/Util.pm Outdated
Comment thread Bugzilla/API/V1/Reminders.pm Outdated
Comment thread qa/t/rest_reminders.t
Comment thread Bugzilla/WebService/Util.pm Outdated
Comment thread Bugzilla/Util.pm Outdated

@dklawren dklawren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. r=dkl

@dklawren
dklawren merged commit c43d43a into mozilla:master Sep 23, 2026
8 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