修复parse_body相关BUG
This commit is contained in:
@ -46,7 +46,7 @@ func Register(requestType string, adaptor abstract.RequestBodyParseAdaptor) {
|
||||
func Execute(ctx *gin.Context, receiver any) ([]byte, error) {
|
||||
contentType := strings.ToLower(strings.ReplaceAll(ctx.ContentType(), " ", ""))
|
||||
if len(contentType) == 0 {
|
||||
return nil, errors.New("content_type is empty")
|
||||
return []byte("{}"), nil
|
||||
}
|
||||
// 裁剪出真实的类型,之所以截取,是因为 content_type 中可能还包含编码信息, 如 : application/json;chaset=utf8
|
||||
contentTypeArr := strings.Split(contentType, ";")
|
||||
|
Reference in New Issue
Block a user