From 200f9c92ade6e0f69cb48cd44c9e03e58fb3c3b1 Mon Sep 17 00:00:00 2001 From: Suraj Patil Date: Tue, 20 Sep 2016 22:24:04 +0530 Subject: [PATCH] get token functionality added --- client/main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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) }