-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: add route.RequestContentType #177
Conversation
1169eee
to
15ebe2c
Compare
Provides the ability for the user to explicitly set what content types and request body can be. Maintains the defaullt of `application/json` and `application/xml`
15ebe2c
to
961c5ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you very much!
@@ -19,6 +19,8 @@ func (rs PetsRessources) Routes(s *fuego.Server) { | |||
fuego.Get(petsGroup, "/{id}", rs.getPets) | |||
fuego.Get(petsGroup, "/by-name/{name...}", rs.getPetByName) | |||
fuego.Put(petsGroup, "/{id}", rs.putPets) | |||
fuego.Put(petsGroup, "/{id}/json", rs.putPets). | |||
RequestContentType("application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
RequestContentType("application/json") | |
ExpectContentType("application/json") |
or
RequestContentType("application/json") | |
RequireContentType("application/json") |
or
RequestContentType("application/json") | |
AcceptContentType("application/json") |
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I'm following?
We're applying the Content-Type for the openapi RequestBody. The following follows the semantics that was used for other operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed the method was expecting the caller to send this.
I might have misunderstood the PR purpose
closes #159
Provides the ability for the user to explicitly
set what content types and request body can be.
Maintains the defaullt of
application/json
andapplication/xml