Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response's body is percent encoded when parametrized queries #96

Open
Nayte91 opened this issue Nov 9, 2022 · 1 comment
Open

Response's body is percent encoded when parametrized queries #96

Nayte91 opened this issue Nov 9, 2022 · 1 comment

Comments

@Nayte91
Copy link

Nayte91 commented Nov 9, 2022

Hello,

When I fetch a resource with a "fields" query parameter, the received fields are percent encoded. But when I vanilla fetch or header-based-fields fetch, the resource's fields are "normal".

Front
scenario A
What I code:

const eventResp = await fetch("https://localhost:8000/events/2?fields=\"\/subtitle\",\"name\"")
console.log(await eventResp.json())

What it outputs:

Object { subtitle: "Internationaux%20de%20France%20de%20tennis%202019", name: "Roland%20Garros%202019" }

ScenarioB
What I code:

const eventResp = await fetch("https://localhost:8000/events/2")
console.log(await eventResp.json())

What it outputs:

Object { "@context": "/contexts/Event", "@id": "/events/2", "@type": "https://schema.org/Event", id: 2, name: "Roland Garros 2019", subtitle: "Internationaux de France de tennis 2019", heading: "120ème édition des Internationaux de France de tennis sont le plus grand tournoi de la saison de tennis sur terre battue.", startDate: "2019-05-26T00:00:00+00:00", endDate: "2019-06-09T00:00:00+00:00", visibility: "public", … }

Back
PHP 6.1 / APIP 3.0.3, served by Caddy 2.7.4 / http.handlers.vulcain v0.5.0

localhost:8000

log

route {
    root * /app/public
    vulcain
    push
    php_fastcgi backend:9000
    encode zstd gzip
    file_server
}

Another proof/test with Postman (see screenshot here)

  1. Is it intended?
  2. What can I do to avoid this behavior?
  3. Do you need more information from my context?

Thank you!

@Nayte91 Nayte91 changed the title Response's body is percent encoded Response's body is percent encoded when parametrized queries Nov 10, 2022
@Nayte91
Copy link
Author

Nayte91 commented Oct 26, 2023

New try with updated stack:
API-Platform 3.2.* / PHP8.2
dunglas/vulcain:latest

nayte@fresh:~/Ephemere-back$ docker compose exec webserver caddy version
Vulcain.rocks 1.0.0 Caddy v2.7.5 h1:xxxxxxxxx...

Caddyfile

localhost:8000 {
    log

    route {
        root * /app/public
        vulcain
        push
        php_fastcgi backend:9000
        encode gzip
        file_server
    }
}

Same "issue"!

image

The test is done locally, as soon as I can update my prod (see #127), the tests will be possible.

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

No branches or pull requests

1 participant