1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 07:02:29 +08:00

fix: fix issue #292, change query params type to map[string][]string

This commit is contained in:
dudaodong
2025-03-28 14:00:11 +08:00
parent 169f280c9c
commit 0ef45b533b
5 changed files with 238 additions and 17 deletions

View File

@@ -201,3 +201,40 @@ func ExampleIsTelnetConnected() {
// true
// false
}
func ExampleBuildUrl() {
urlStr, err := BuildUrl(
"https",
"example.com",
"query",
map[string][]string{
"a": {"foo", "bar"},
"b": {"baz"},
},
)
fmt.Println(urlStr)
fmt.Println(err)
// Output:
// https://example.com/query?a=foo&a=bar&b=baz
// <nil>
}
func ExampleAddQueryParams() {
urlStr := "https://example.com"
params := map[string][]string{
"a": {"foo", "bar"},
"b": {"baz"},
}
urlStr, err := AddQueryParams(urlStr, params)
fmt.Println(urlStr)
fmt.Println(err)
// Output:
// https://example.com?a=foo&a=bar&b=baz
// <nil>
}