Skip to content

Commit

Permalink
Implements changes from code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaLaGrotteria committed Nov 18, 2024
1 parent 5203ec8 commit e6400ca
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ The generated application contains a `Controller` which exposes two routes (`GET
source:DefaultController[]

callout:controller[arg0=/default]
<.> The @api@/io/micronaut/http/annotation/Get.html[@Get] annotation maps the `index` method to all requests that use an HTTP GET.
<.> By default, a Micronaut response uses `application/json` as `Content-Type`. `index` method returns a String not a JSON object. Because of that, we set the response content-type to `text/plain` with the `@Produces` annotation.
<.> The @api@/io/micronaut/http/annotation/Post.html[@Post] annotation maps the `postMethod` method to all requests that use an HTTP GET.
callout:get[arg0=index,arg1=/default]
callout:text-plain[]
callout:post[arg0=postMethod,arg1=/default]
callout:introspected[]

== Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The generated application contains a `HomeController`. It responds to POST reque
source:HomeController[]

callout:controller[arg0=/]
<.> The `@Get` annotation maps HTTP requests to `/` to the `index` method.
callout:get[arg0=index,arg1=/]

== Controller Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The generated application contains a `HomeController`. It responds to POST reque
source:HomeController[]

callout:controller[arg0=/]
<.> The `@Get` annotation maps HTTP requests to `/` to the `index` method.
callout:get[arg0=index,arg1=/]

The generated tests illustrates how the code works when the lambda gets invoked:

Expand Down
2 changes: 1 addition & 1 deletion src/docs/common/callouts/callout-text-plain.adoc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<.> By default, a Micronaut response uses `application/json` as `Content-Type`. We are returning a String, not a JSON object, so we set it to `text/plain`.
<.> By default, a Micronaut response uses `application/json` as `Content-Type`. We are returning a String, not a JSON object, so we set it to `text/plain` with the `@Produces` annotation.

0 comments on commit e6400ca

Please sign in to comment.