fix: api descript
This commit is contained in:
@@ -5,6 +5,8 @@ package middleware
|
||||
|
||||
import "net/http"
|
||||
|
||||
const maxUploadSizeBytes int64 = 20 << 20
|
||||
|
||||
type FileSizeLimitMiddleware struct {
|
||||
}
|
||||
|
||||
@@ -14,9 +16,10 @@ func NewFileSizeLimitMiddleware() *FileSizeLimitMiddleware {
|
||||
|
||||
func (m *FileSizeLimitMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO generate middleware implement function, delete after code implementation
|
||||
if r.Method == http.MethodPost && r.URL != nil && r.URL.Path == "/api/v1/upload" {
|
||||
r.Body = http.MaxBytesReader(w, r.Body, maxUploadSizeBytes)
|
||||
}
|
||||
|
||||
// Passthrough to next handler if need
|
||||
next(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user