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