Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG][RUST] Reqwest - encoding of spaces in path parameters

Aperta Adatta ai principianti
#25,257 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@GlenWright ci sta già lavorando.

Dal 14/10/2026.

  • #25258 di @GlenWright — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
api

Direzione di ricerca

Il bug si trova nella funzione di supporto urlencode in api_mod.mustache, che i template Rust reqwest e reqwest-trait usano per i parametri di percorso. Genera un client dalla specifica nella issue e verifica che uno spazio venga emesso come +, poi leggi quella funzione di supporto. È completato quando uno spazio in un parametro di percorso viene codificato come %20, un + letterale continua a essere codificato come %2B e gli output di reqwest e reqwest-trait cambiano entrambi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue: Bug
Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When using reqwest, path parameters with spaces are incorrectly encoded with a + instead of %20. For example, Glen Wright becomes Glen+Wright, when it should be Glen%20Wright.

openapi-generator version

Reproduced with latest at time of writing: 1fdc3307942fcf853990cda8701d71c7e0753157.

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Reqwest - path parameter space encoding
  version: "1.0.0"
paths:
  /api/{spacedParam}:
    parameters:
      - in: path
        name: spacedParam
        schema:
          type: string
        required: true
        description: A path parameter with a space.
    get:
      operationId: getValue
      responses:
        '200':
          description: A returned value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/returnedValue'
              example:
                spacedParam: A path parameter with a + instead of a space.
components:
  schemas:
    returnedValue:
      type: object
      required:
        - spacedParam
      properties:
        spacedParam:
          type: string
Generation Details

Generate client with -i spec.yaml -g rust -o output.

Steps to reproduce
  • Generate client as above.
  • Call api.get_value(&config, "Spaced Param");
  • Observe that the path parameter is encoded as Spaced+Param.
Related issues/PRs

#11242. is the same issue, but for Java.

Suggest a fix

Update the urlencode function in api_mod.mustache for reqwest and reqwest-trait to replace + with %20. This will not impact actual instances of + as they are encoded properly as %2B.

Lingua principale
Java
Stelle
26.8k
Fork
7.7k
Merge medio
1g 15h
PR unite (30g)
158

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenAPITools/openapi-generator

Tutte le issue di OpenAPITools/openapi-generator

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.