get token functionality added
This commit is contained in:
parent
4fa83089ee
commit
200f9c92ad
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue