From 528a201827518d064ee90fb3525f660df6399b14 Mon Sep 17 00:00:00 2001 From: mpl Date: Tue, 19 Jan 2016 00:39:13 +0100 Subject: [PATCH] website: make /apiget in demo authenticated too Change-Id: Ief662a69774fcc919c4e3618df91886cb1f05b84 --- website/chrome_bug-repro.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/website/chrome_bug-repro.go b/website/chrome_bug-repro.go index fd0df1e37..fdf6262fe 100644 --- a/website/chrome_bug-repro.go +++ b/website/chrome_bug-repro.go @@ -137,11 +137,14 @@ func repro(host, userpass string) error { fmt.Fprint(w, clientCode()) }) mux.HandleFunc("/apiget", func(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - http.Error(w, "NOT A GET", http.StatusBadRequest) - return + if up.isAllowed(r) { + if r.Method != "GET" { + http.Error(w, "NOT A GET", http.StatusBadRequest) + return + } + fmt.Fprintf(w, "Hello World, it is %v, and I received a %v for %v.", time.Now(), r.Method, r.URL.Path) } - fmt.Fprintf(w, "Hello World, it is %v, and I received a %v for %v.", time.Now(), r.Method, r.URL.Path) + sendUnauthorized(w, r) }) mux.HandleFunc("/apipost", func(w http.ResponseWriter, r *http.Request) { if up.isAllowed(r) {