Limit incoming request body size for all endpoints and add rate limiting wrappera round storage

This commit is contained in:
breel
2020-07-26 20:25:39 -06:00
parent c3b948556c
commit 36c4ae520d
6 changed files with 86 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ package entity
import (
"encoding/json"
"fmt"
"strings"
"time"
"go.mongodb.org/mongo-driver/bson"
@@ -68,6 +69,12 @@ func (o One) MarshalBSON() ([]byte, error) {
if err := json.Unmarshal(b, &m); err != nil {
return nil, err
}
for k, v := range m {
switch v.(type) {
case string:
m[k] = strings.TrimSpace(v.(string))
}
}
if name, ok := m[JSONName]; ok {
m[Name] = name
delete(m, JSONName)