photos-api/internal/photos/api/check_body.go
2022-03-02 16:32:27 +01:00

16 lines
317 B
Go

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