From 5d61cf33cfd387c788cb981ce4e303573375831e Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Mon, 20 Jun 2016 20:10:34 +0200 Subject: [PATCH] Send HTTP code depending on authorization received (for real ;)) --- http/http.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/http/http.go b/http/http.go index 5b481d3..f965814 100644 --- a/http/http.go +++ b/http/http.go @@ -57,8 +57,12 @@ func authHandler(w http.ResponseWriter, r *http.Request) { ChanRequest <- chanAnswer select { - case answer = <-chanAnswer: - w.WriteHeader(http.StatusOK) + case answer := <-chanAnswer: + if answer { + w.WriteHeader(http.StatusOK) + } else { + w.WriteHeader(http.StatusForbidden) + } case <-time.After(time.Duration(TimeoutSec) * time.Second): w.WriteHeader(http.StatusForbidden) delete(xmpp.WaitMessageAnswers, transaction)