From 37bf8b04e76ea1cce678238af48ac8097348e655 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Wed, 22 May 2019 02:50:34 -0400 Subject: tuning query handling --- main.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 61acb42..43c204b 100644 --- a/main.go +++ b/main.go @@ -51,12 +51,27 @@ func main() { Methods("GET"). HandlerFunc(apiEndpointHandler) - // This is for submitting new users + // This is for submitting new users. Both query variables must exist + // in the request for this to match. api.Path("/{format:(?:plain)}/{endpoint:users}"). Queries("url", "{url}", "nickname", "{nickname:[a-zA-Z0-9_-]+}"). Methods("POST"). HandlerFunc(apiEndpointPOSTHandler) + // This is for submitting new users incorrectly + // and letting the requester know about their error. + api.Path("/{format:(?:plain)}/{endpoint:users}"). + Queries("url", "{url}"). + Methods("POST"). + HandlerFunc(apiEndpointPOSTHandler) + + // This is for submitting new users incorrectly + // and letting the requester know about their error. + api.Path("/{format:(?:plain)}/{endpoint:users}"). + Queries("nickname", "{nickname:[a-zA-Z0-9_-]+}"). + Methods("POST"). + HandlerFunc(apiEndpointPOSTHandler) + // Show all observed tags api.Path("/{format:(?:plain)}/tags"). Methods("GET"). -- cgit 1.4.1-2-gfad0