What number of ranges of authorization do you want? You talked about 2 ranges.
To get the present URL with question string in Golang, you should utilize the Request.URL
subject of the *http.Request
struct. This subject will comprise the complete URL of the request, together with the question string.
For instance, the next code will get the present URL with question string:
package deal predominant
import (
"fmt"
"web/http"
)
func predominant() {
request, err := http.NewRequest("GET", "https://discussion board.golangbridge.org/", nil)
if err != nil {
fmt.Println(err)
return
}
url := request.URL
fmt.Println(url.String())
}
This code will first create a brand new http.Request
object. Then, it’ll get the URL
subject of the request object and print it to the console.
The output of the code would be the full URL of the request, together with the question string.
If you wish to parse the URL and get the web page URL values, you should utilize the ParseQuery()
perform. This perform will parse the question string and return a map of key-value pairs.