From 5aa2c012cd525187bb06d408ebc84495df5941a4 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Mon, 9 Jul 2018 18:48:09 +0200 Subject: [PATCH] Add Accept header to request --- cmd/eksterd/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/eksterd/main.go b/cmd/eksterd/main.go index 3489622..f2a8621 100644 --- a/cmd/eksterd/main.go +++ b/cmd/eksterd/main.go @@ -27,6 +27,7 @@ import ( "net/url" "os" "regexp" + "strings" "time" "github.com/garyburd/redigo/redis" @@ -161,7 +162,11 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { reqData.Set("code", code) reqData.Set("client_id", sess.ClientID) reqData.Set("redirect_uri", sess.RedirectURI) - resp, err := http.PostForm(sess.AuthorizationEndpoint, reqData) + + req, err := http.NewRequest("POST", sess.AuthorizationEndpoint, strings.NewReader(reqData.Encode())) + req.Header.Add("Accept", "application/json") + client := http.Client{} + resp, err := client.Do(req) if err != nil { fmt.Fprintf(w, "ERROR: %q\n", err) return