From fff7b6ae47feb578af97746cafa819b420d6bbaf Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 27 Mar 2024 12:49:55 +0100 Subject: [PATCH] Simplified server API --- Server.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Server.go b/Server.go index eb12ad8..79ee63b 100644 --- a/Server.go +++ b/Server.go @@ -17,10 +17,7 @@ import ( // Server is the interface for an HTTP server. type Server interface { - Delete(path string, handler Handler) Get(path string, handler Handler) - Post(path string, handler Handler) - Put(path string, handler Handler) Request(method string, path string, body io.Reader) Response Router() *router.Router[Handler] Run(address string) error @@ -70,21 +67,6 @@ func (s *server) Get(path string, handler Handler) { s.Router().Add("GET", path, handler) } -// Post registers your function to be called when the given POST path has been requested. -func (s *server) Post(path string, handler Handler) { - s.Router().Add("POST", path, handler) -} - -// Delete registers your function to be called when the given DELETE path has been requested. -func (s *server) Delete(path string, handler Handler) { - s.Router().Add("DELETE", path, handler) -} - -// Put registers your function to be called when the given PUT path has been requested. -func (s *server) Put(path string, handler Handler) { - s.Router().Add("PUT", path, handler) -} - // Request performs a synthetic request and returns the response. // This function keeps the response in memory so it's slightly slower than a real request. // However it is very useful inside tests where you don't want to spin up a real web server.