Skip to content

Commit

Permalink
web: do not send file if its a head request
Browse files Browse the repository at this point in the history
  • Loading branch information
l3uddz committed Apr 4, 2021
1 parent f3a14cd commit b7c54a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions web/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import (
)

func (c *Client) Load(g *gin.Context) {
// head request
if g.Request.Method == http.MethodHead {
g.Status(http.StatusOK)
return
}

// parse query
b := new(fileRequest)
if err := g.ShouldBindUri(b); err != nil {
Expand Down Expand Up @@ -46,6 +40,12 @@ func (c *Client) Load(g *gin.Context) {
return
}

// head request (dont send file)
if g.Request.Method == http.MethodHead {
g.Status(http.StatusOK)
return
}

// return file
g.File(b.Filepath)
}

0 comments on commit b7c54a6

Please sign in to comment.