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

Add option to generate "all information of HTTP request" in controllers #212

Open
atollk opened this issue May 17, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@atollk
Copy link
Contributor

atollk commented May 17, 2023

(This was actually described in #162 already but only authentication was implemented in #186)

Both Spring and Micronaut offer to inject an object into their controller methods which provides "all" data of a request. For example, query parameters can be accessed via a map. This can offer more flexibility to controller implementations.

For Micronaut, a new parameter is added to endpoint methods:

@Get
fun example(
  httpRequest: HttpRequest<T>,
) {/* ... */}

"T" in this example, refers to the body type, i.e. the "DTO" that could also be injected by using the @Body annotation.
For endpoints that accept no body, e.g. usual "GET" requests, we use * instead, i.e. HttpRequest<*>.

For Spring, this is almost the same, just that we use HttpEntity rather than HttpRequest.

This would cause a breaking change compared to current code generation (and might be undesirable to some developers anyway) so it'd need to be enabled conditionally with a flag.

@averabaq averabaq added the enhancement New feature or request label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants