gofiber / fiber

⚡️ Express inspired web framework written in Go
https://gofiber.io
MIT License
33.12k stars 1.63k forks source link

🤗 [Question]: Is there any way to avoid parsing URLEncoded on Agent? #3096

Open luiz-otavio opened 1 month ago

luiz-otavio commented 1 month ago

Question Description

I've to make some requests to a specific host with an URL encoded through the params, such as: https://example.my.host/other.host%2path%2to%2data%31231231

But instead, it parses to: https://example.my.host/other.host/path/to/data/31231231

I tried using DisablePathNormalizing from my agent, but it didn't work and seems like it doesn't apply any effect on the method Parse from FastHttp.

Code Snippet (optional)

package main

import "github.com/gofiber/fiber/v3"
import "log"

func main() {
    agent := fiber.Get(fmt.Sprintf("https://example.my.host/%s", url.QueryEncode("other.host/path/to/data/31231231")))

    // If you tries to debug it, it'll show like 
    // https://example.my.host/other.host%2path%2to%2data%231231231

    agent.DisablePathNormalizing = true
    agent.Set("Content-Type", "application/json")

    // It parses to https://example.my.host/other.host/path/to/data/31231231
    slog.Info("URL: ", agent.Request().URI().String())
}

Checklist:

welcome[bot] commented 1 month ago

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord