-
Hi, as it is said in the subject. I want to use the PathParams without escaping. Is there anyway to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @SVilgelm , I look into the docs, we can For example: package main
import "github.com/go-resty/resty/v2"
func main() {
// Create a Resty Client
client := resty.New()
client.R().SetPathParams(map[string]string{
"userId": "[email protected]",
"subAccountId": "100002",
}).
Get("https://webhook.site/9e0d8a64-0ed1-4e28-ae32-ddd26fae5e1d/{userId}/{subAccountId}")
// Result:
// Composed URL - https://webhook.site/9e0d8a64-0ed1-4e28-ae32-ddd26fae5e1d/[email protected]/100002
} You can see the docs here: https://github.com/go-resty/resty#request-url-path-params Hope this help answered your questions. |
Beta Was this translation helpful? Give feedback.
-
Here is my example: package main
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
resp, err := resty.New().R().SetPathParam("id", "foo/bar/xyz").Get("https://webhook.site/44923f70-4cb5-464c-ac76-217762c5cee8/{id}")
fmt.Printf("err: %s\n", err)
fmt.Printf("resp: %s: %s\n", resp.Status(), resp.String())
fmt.Printf("url: %s", resp.Request.URL)
} output: % go run main.go
err: %!s(<nil>)
resp: 200 OK:
url: https://webhook.site/44923f70-4cb5-464c-ac76-217762c5cee8/foo%2Fbar%2Fxyz% https://webhook.site/#!/44923f70-4cb5-464c-ac76-217762c5cee8/0f62631f-e8d4-4799-b9a7-5b353154b1fa/1 as you can see the value of |
Beta Was this translation helpful? Give feedback.
-
The RawPathParams feature was added in #664 and released with v2.8.0. Of course, you know it. |
Beta Was this translation helpful? Give feedback.
The RawPathParams feature was added in #664 and released with v2.8.0. Of course, you know it.