~sircmpwn/searchhut-devel

web: answer HEAD requests v1 APPLIED

Umar Getagazov: 1
 web: answer HEAD requests

 1 files changed, 10 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/searchhut-devel/patches/33895/mbox | git am -3
Learn more about email & git

[PATCH] web: answer HEAD requests Export this patch

Fixes: https://todo.sr.ht/~sircmpwn/searchhut/42
---
 cmd/sh-web/main.go | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/cmd/sh-web/main.go b/cmd/sh-web/main.go
index 6488359..235e9ef 100644
--- a/cmd/sh-web/main.go
+++ b/cmd/sh-web/main.go
@@ -37,6 +37,15 @@ type AboutPage struct {
	CrawlerUA string
}

type router struct {
	*chi.Mux
}

func (r *router) Get(pattern string, handlerFn http.HandlerFunc) {
	r.Mux.Get(pattern, handlerFn)
	r.Mux.Head(pattern, handlerFn)
}

func main() {
	conf := config.Load()
	port, ok := conf.Get("searchhut::web", "bind")
@@ -44,7 +53,7 @@ func main() {
		port = ":8081"
	}

	router := chi.NewRouter()
	router := router{chi.NewRouter()}
	router.Use(middleware.RealIP)
	router.Use(middleware.Logger)
	router.Use(middleware.Timeout(10 * time.Second))
-- 
2.32.1 (Apple Git-133)
Thanks!

To git@git.sr.ht:~sircmpwn/searchhut
   562fecf..2b6407e  master -> master