Skip to content

Override defaults across String and Symbol query keys - #47

Open
yorzi wants to merge 1 commit into
serpapi:masterfrom
yorzi:fix/query-key-overrides
Open

yorzi wants to merge 1 commit into
serpapi:masterfrom
yorzi:fix/query-key-overrides

Conversation

@yorzi

@yorzi yorzi commented Nov 17, 2026

Copy link
Copy Markdown

What this does

Remove constructor defaults whose String/Symbol counterpart is present
in the call before merging. Keys and values are preserved rather than
globally normalized. This extends the existing output-key override
precedent to normal request parameters.

Nine regressions fail on the base: both key directions for engines,
API keys, and unknown backend options, plus nil removal, array replacement,
and multipart API-key replacement. Eight guards cover untouched defaults,
output precedence, and forced Extract/HTML/Markdown parameters.

The fix does not mutate input Hashes or multipart IOs, add dependencies,
change error handling, or resolve ambiguous duplicate spellings within
a single call. Existing output precedence and nil compaction are retained.

No live fixture needs re-recording: the tests serialize requests without
sending them. Existing docs already promise per-call overrides, so the
only documentation change is a changelog entry.
Open #39 and #42 remain separate. Their current patches apply alongside
this fix and the separate fix for #44.

Type of change

  • Bug fix
  • New feature (not applicable)
  • Breaking change (restores documented overrides)
  • Documentation (contract documentation is unchanged)
  • Performance improvement (not claimed)

Scope check

  • I read the contributing guide
  • This fits serpapi-ruby's stated focus
  • This isn't application-specific logic that belongs in user code
  • This benefits users mixing accepted key types

Related issue

Fixes #45

Quality check

Focused/regression/compatibility harnesses block network access.
The mocked specs used only an invalid non-secret placeholder to pass
the global API-key guard. No coverage-completeness claim is made.

Ownership

  • I understand every line of this change and can answer questions about it

API changes

  • Breaking change (not intended)
  • New public methods or classes (none)
  • Changed method signatures (none)
  • No API changes

String and Symbol keys are accepted for request parameters, but merging
them as distinct Hash keys sends both defaults and overrides under the
same HTTP field name.

Remove a default when its opposite key type is present in the call.
Preserve actual key objects, payload values, output precedence, and nil
compaction.

Fixes serpapi#45
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.

Mixed String and Symbol overrides send duplicate parameters

1 participant