Mixed String and Symbol overrides send duplicate parameters
@yorzi ya está trabajando en esto.
Desde el 17/11/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ruby
- Área
- backend-api-design
Línea de trabajo
Lee lib/serpapi/client.rb, especialmente el constructor en la línea 64 y query en la línea 290, junto con la promesa de la README sobre la sobrescritura de parámetros. Empieza ejecutando la reproducción del issue después de bundle install y luego inspecciona las specs existentes para las sobrescrituras de query y las cargas de imágenes. Se considera terminado cuando las claves String y Symbol mezcladas envíen solo el valor que sobrescribe cada parámetro y haya tests que cubran parámetros normales y de carga.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Basic checks
- I searched existing issues, open and closed, and found no general mixed-key override fix
- I can reproduce this consistently on
master - This is a serpapi-ruby bug, not my application code
What's broken?
The constructor accepts String and Symbol keys
(lib/serpapi/client.rb:64), and README.md:88-117 promises that per-call
parameters override defaults. But query at client.rb:290 merges raw
Ruby Hash keys. If the call and default use different key types, both
reach HTTP.rb and are encoded with the same parameter name.
This affects engines, API-key overrides, nil overrides, and arbitrary
backend fields. It also affects image-upload form fields. A default that
should have been replaced is still sent. No particular server-side
precedence for duplicate parameters is assumed.
#29 already handles
this for output, and #37
handles Extract's forced engine. This report concerns ordinary overrides.
It does not include the Hash mutation in
#39 or error policy in
#42.
How to reproduce
From the repository root, after bundle install. HTTP.rb builds the real
request; perform is intercepted before network I/O:
bundle exec ruby -Ilib - <<'RUBY'
require 'serpapi'
response = Struct.new(:status, :headers, :body).new(
200, { 'Content-Type' => 'application/json' }, '{}'
)
transport = HTTP::Client.new
transport.define_singleton_method(:perform) do |request, _options|
p request.uri.query_values(Array).select { |key, _| key == 'engine' }
response
end
HTTP.define_singleton_method(:timeout) { |_timeout| transport }
client = SerpApi::Client.new('engine' => 'google', persistent: false)
client.search(engine: 'bing')
RUBY
Expected behavior
[["engine", "bing"]]
What actually happened
[["engine", "google"], ["engine", "bing"]]
I have a small local fix with tests and can open a PR.
Environment
- Ruby 3.4.4, macOS arm64
- serpapi-ruby
masterat786baa6848020df031abed734ed7ff03af3a6560 - HTTP.rb 5.3.1, RSpec 3.13.2
- No API credentials, external requests, or search credits used
- Lenguaje dominante
- Ruby
- Estrellas
- 43
- Forks
- 27
- Merge medio
- 3 d 21 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de serpapi/serpapi-ruby
-
Constructor symbolize_names defaults are ignoredPosiblemente ocupada @yorzi la tomó hace 9 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
serpapi/serpapi-ruby#44 ·
Todos los issues de serpapi/serpapi-ruby
Issues similares
-
good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
erkamyaman/rust-anything#702 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
slovensko-digital/govbox-pro#986 ·
Los mantenedores suelen responder en 1 día
-
community
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
newrelic/newrelic-ruby-agent#3737 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día