Limit incoming request body size for all endpoints and add rate limiting wrappera round storage
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user