S
S
Sergey2017-08-25 21:17:35
go
Sergey, 2017-08-25 21:17:35

How to make a GET request in Golang?

Can you help me with a get request?

Функция 

var agr1 := 1
var arg3 := 2
var agr3 := 3
var arg4 := 4


func get()  {
      http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    path := r.URL.Path
    c := http.Client{}
    resp, err := c.Get("http://127.0.0.1:8087/webapi/lua%20
    if err != nil {
      log.Println(err)
    }
    defer resp.Body.Close()
    body, _ := ioutil.ReadAll(resp.Body)
    w.WriteHeader(200)
    w.Write(body)
  })



}

Here is the get request
localhost:8087/webapi/.lua%20 argument1%20argument2%20argument3%20argument4 The
question is how to form a get request with arguments

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question