From 89d455537430f1cd116ea8a00531c38cafc4bb99 Mon Sep 17 00:00:00 2001 From: Marcus Rohrmoser Date: Sun, 13 Jan 2019 00:31:08 +0100 Subject: [PATCH] /v1/get sunshine. https://github.com/mro/Shaarli-API-test/issues/7 --- pinboard.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pinboard.go b/pinboard.go index d46d6cf..6452411 100644 --- a/pinboard.go +++ b/pinboard.go @@ -90,6 +90,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { } if "GET" != r.Method { + w.Header().Set("Allow", "GET") http.Error(w, "All API methods are GET requests, even when good REST habits suggest they should use a different verb.", http.StatusMethodNotAllowed) return } @@ -189,6 +190,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { } if "GET" != r.Method { + w.Header().Set("Allow", "GET") http.Error(w, "All API methods are GET requests, even when good REST habits suggest they should use a different verb.", http.StatusMethodNotAllowed) return } @@ -210,6 +212,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { } if "GET" != r.Method { + w.Header().Set("Allow", "GET") http.Error(w, "All API methods are GET requests, even when good REST habits suggest they should use a different verb.", http.StatusMethodNotAllowed) return } @@ -226,6 +229,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { } if "GET" != r.Method { + w.Header().Set("Allow", "GET") http.Error(w, "All API methods are GET requests, even when good REST habits suggest they should use a different verb.", http.StatusMethodNotAllowed) return } @@ -303,7 +307,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { return } - t, err := time.Parse("2006-01-02_150405", formLink.Get("lf_linkdate")) // rather ParseInLocation + t, err := time.Parse("20060102_150405", formLink.Get("lf_linkdate")) // rather ParseInLocation if err != nil { http.Error(w, err.Error(), http.StatusBadGateway) return @@ -324,7 +328,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { rawText("