kataras / iris

The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket:
https://www.iris-go.com
BSD 3-Clause "New" or "Revised" License
25.16k stars 2.48k forks source link

ctx.ReadBody cant't get map type POST value #2481

Closed hiscaler closed 3 weeks ago

hiscaler commented 4 weeks ago

Post data

{
    "platform": "tt",
    "status": 1,
    "configuration": {
        "a": "aaaa"
    }
}
type editThirdPartyAccountRequest struct {
    Platform      string            `json:"platform" form:"platform"`
    Configuration map[string]string `json:"configuration" form:"configuration"`
    Status        int8              `json:"status" form:"status"`
}

// Controller
var editRequest editThirdPartyAccountRequest

if err = ctx.ReadBody(&editRequest); err != nil {
    fmt.Println(fmt.Sprintf("feeeeee %#v", editRequest))
    return
}

ReadJson also no effect with configuration value

hiscaler commented 3 weeks ago

It's my test tools question, ok now.