Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hiscaler opened this issue Aug 20, 2024 · 1 comment
Closed

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

hiscaler opened this issue Aug 20, 2024 · 1 comment

Comments

@hiscaler
Copy link

hiscaler commented Aug 20, 2024

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 hiscaler changed the title ctx.ReadJson cant't get map type value ctx.ReadBody cant't get map type value Aug 20, 2024
@hiscaler hiscaler changed the title ctx.ReadBody cant't get map type value ctx.ReadBody cant't get map type POST value Aug 20, 2024
@hiscaler
Copy link
Author

It's my test tools question, ok now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant