Try to create better request

This commit is contained in:
Peter Stuifzand 2018-07-09 19:01:03 +02:00
parent 24a71a6b43
commit a8918e59d0

View File

@ -163,9 +163,11 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
reqData.Set("client_id", sess.ClientID) reqData.Set("client_id", sess.ClientID)
reqData.Set("redirect_uri", sess.RedirectURI) reqData.Set("redirect_uri", sess.RedirectURI)
req, err := http.NewRequest("POST", sess.AuthorizationEndpoint, strings.NewReader(reqData.Encode())) // resp, err := http.PostForm(sess.AuthorizationEndpoint, reqData)
req, err := http.NewRequest(http.MethodPost, sess.AuthorizationEndpoint, strings.NewReader(reqData.Encode()))
req.Header.Add("Accept", "application/json") req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Write(os.Stderr)
client := http.Client{} client := http.Client{}
resp, err := client.Do(req) resp, err := client.Do(req)
if err != nil { if err != nil {