photos-api/internal/photos/api/check_body.go
2022-02-05 11:21:45 +01:00

15 lines
248 B
Go

package api
import (
"net/http"
"github.com/gin-gonic/gin"
)
func (s *Service) RequireBody(c *gin.Context) {
if c.Request.Method == "POST" && c.Request.ContentLength == 0 {
s.Error(c, http.StatusBadRequest, ErrReqMissingBody)
return
}
}