From b9f3db79982677bae13c1469159899156b2b063f Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Sun, 5 Jun 2016 22:29:18 +0200 Subject: [PATCH] Return HTTP code depending on authorization given by the user --- http/http.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/http/http.go b/http/http.go index 251d990..df22469 100644 --- a/http/http.go +++ b/http/http.go @@ -57,19 +57,13 @@ func authHandler(w http.ResponseWriter, r *http.Request) { ChanRequest <- transaction ChanRequest <- chanAnswer - ret := RETURN_VALUE_NOK - answer := false select { case answer = <- chanAnswer: + w.WriteHeader(http.StatusOK) case <- time.After(time.Duration(TimeoutSec) * time.Second): - answer = false + w.WriteHeader(http.StatusForbidden) delete(xmpp.WaitMessageAnswers, transaction) } - if answer { - ret = RETURN_VALUE_OK - } - // TODO reply with JSON format - fmt.Fprintf(w, ret) }