diff --git a/client/main.go b/client/main.go index f92f4f8..556e7d5 100644 --- a/client/main.go +++ b/client/main.go @@ -1,11 +1,24 @@ package main import "net/http" +import "net/url" import "fmt" import "io/ioutil" func main() { - resp, err := http.Get("http://127.0.0.1:8081/api/get-token") + //client := &http.Client{} + //req, err := http.NewRequest("POST", "http://127.0.0.1:8081/api/get-token/", nil) + + usernamePwd := url.Values{} + usernamePwd.Set("username", "suraj") + usernamePwd.Set("password", "suraj") + + // if err != nil { + // fmt.Println("Unable to form a POST") + // } + //req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + //resp, err := client.Do(req) + resp, err := http.PostForm("http://127.0.0.1:8081/api/get-token/", usernamePwd) if err != nil { fmt.Println(err) }