handle head requests

This commit is contained in:
Niko Storni 2021-09-22 17:28:13 +02:00
parent eb6418bc97
commit fd64cadc4e

View file

@ -94,6 +94,7 @@ func main() {
r.Use(cors.New(corsConfig))
r.POST("/api/claim/publish", publish)
r.GET("/*url", view)
r.HEAD("/*url", view)
r.MaxMultipartMemory = 8 << 20 // 8 MiB
r.Run(":5000")
}
@ -115,6 +116,10 @@ func view(c *gin.Context) {
_ = c.AbortWithError(http.StatusBadRequest, fmt.Errorf("invalid url: %s", c.Param("url")))
return
}
if c.Request.Method == http.MethodHead {
c.AbortWithStatus(200)
return
}
resizeParams := ""
redirectBaseURL := "https://lbry2.vanwanet.com/speech/"