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

Porposal: Form url-encoded support in API #1590

Open
srs opened this issue Nov 21, 2024 · 0 comments
Open

Porposal: Form url-encoded support in API #1590

srs opened this issue Nov 21, 2024 · 0 comments

Comments

@srs
Copy link

srs commented Nov 21, 2024

I would like the support for other media-types in API specification than application/json. Right now I am using a raw endpoint, but it would be really nice if application/x-www-form-urlencoded would also be supported. Best would be a combination so it's checking both.

How I used to do this before (with echo framework) on certain endpoints - like OAuth token endpoints - would be to annotate request structs with the following:

type GrantTokenParams struct {
  GrantType string `json:"grant_type" form:"grant_type" valid:"required"`
  Username  string `json:"username" form:"username"`
  Password  string `json:"password" form:"password"`
}

The logic would be if the content-type is application/x-www-form-urlencoded it would use the form tags. Else if application/json is the content-type it would behave as normal.

Would this be something that is feasable and/or wanted by others?

@srs srs changed the title Porposal: Form url-encoded support API Porposal: Form url-encoded support in API Nov 21, 2024
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