handle head requests
This commit is contained in:
parent
eb6418bc97
commit
fd64cadc4e
1 changed files with 5 additions and 0 deletions
5
main.go
5
main.go
|
@ -94,6 +94,7 @@ func main() {
|
||||||
r.Use(cors.New(corsConfig))
|
r.Use(cors.New(corsConfig))
|
||||||
r.POST("/api/claim/publish", publish)
|
r.POST("/api/claim/publish", publish)
|
||||||
r.GET("/*url", view)
|
r.GET("/*url", view)
|
||||||
|
r.HEAD("/*url", view)
|
||||||
r.MaxMultipartMemory = 8 << 20 // 8 MiB
|
r.MaxMultipartMemory = 8 << 20 // 8 MiB
|
||||||
r.Run(":5000")
|
r.Run(":5000")
|
||||||
}
|
}
|
||||||
|
@ -115,6 +116,10 @@ func view(c *gin.Context) {
|
||||||
_ = c.AbortWithError(http.StatusBadRequest, fmt.Errorf("invalid url: %s", c.Param("url")))
|
_ = c.AbortWithError(http.StatusBadRequest, fmt.Errorf("invalid url: %s", c.Param("url")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if c.Request.Method == http.MethodHead {
|
||||||
|
c.AbortWithStatus(200)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resizeParams := ""
|
resizeParams := ""
|
||||||
redirectBaseURL := "https://lbry2.vanwanet.com/speech/"
|
redirectBaseURL := "https://lbry2.vanwanet.com/speech/"
|
||||||
|
|
Loading…
Reference in a new issue