Go net/url
本篇文章說明 net/url 的部分函式和結構
- url.URL
- url.URL.Path
- url.URL.RawQuery
- url.Values
- url.Parse
- Set query string from struct
url.URL
1 | type URL struct { |
1 | [scheme:][//[userinfo@]host][/]path[?query][#fragment] |
url.URL.Path
1 | location := url.URL{Path: "/member"} |
url.URL.RawQuery
1 | location := url.URL{ |
url.Values
1 | data := url.Values{"message": {"123"}} |
url.Parse
1 | u, _:= url.Parse("https://example.org/error?msg=123") |
Set query string from struct
1 | /*** /error?message=empty&signal=true ***/ |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.