Skip to content

Commit 62807b1

Browse files
update .md
1 parent a03529c commit 62807b1

File tree

1 file changed

+9
-43
lines changed

1 file changed

+9
-43
lines changed

README.md

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ You get bonus points if:
6262
-**WebClient** ✅ Interacting with 3rd party endpoints, WebClient was chosen for making non-blocking & asynchronous endpoint.
6363
-**RestTemplate** ❌ Older way to make calls in Spring and synchronous. [RestTemplate](https://www.baeldung.com/rest-template).
6464
-**Feign Client** ❌ Also synchronous. [Feign Client](https://www.baeldung.com/spring-boot-feignclient-vs-webclient).
65-
- [![Netty](https://img.shields.io/badge/Netty-grey?style=for-the-badge&logo=googleearth&logoColor=FFFFFF)](https://projectreactor.io/docs/netty/1.1.21/reference/index.html)
65+
- [![Netty](https://img.shields.io/badge/Netty-grey?style=for-the-badge&logo=googleearth&logoColor=FFFFFF)](https://projectreactor.io/docs/netty/1.1.21/reference/index.html).
6666
-**Netty**✅ is suited for Microservices Architecture, for its non-blocking I/O client-server nature.
67-
- [![Lombok](https://img.shields.io/badge/Lombok-green?style=for-the-badge)](https://docs.spring.io/spring-framework/reference/web/webflux.html)
67+
- [![Lombok](https://img.shields.io/badge/Lombok-green?style=for-the-badge)](https://docs.spring.io/spring-framework/reference/web/webflux.html).
6868
-**Lombok**✅ For reducing boilerplate code.
6969

7070
- We are making `application.yml` for this microservices.
7171
- If this microservice would ran in different environment.
7272

7373
- Domain classes represents classes inside business logic.
74-
- DTO classes represents REST API
74+
- DTO classes represents REST API.
7575

7676
## How to run the application.
7777

@@ -88,23 +88,23 @@ docker compose up
8888
...
8989

9090

91-
<details>
91+
<details style="visibility:hidden">
9292
<summary id="problem1">Weird Feature 1.</summary>
9393

9494

9595
- I came to notice when making **POST** request to the address of `https://countriesnow.space/api/v0.1/countries/population` it would work for **PostMan**, but not for **ReactorNetty**.
9696

97-
- Tool to catch the request were **Request Catcher**, it helped me to distinguish if there were some error in the request what **Netty** was making. URL of catcher `https://test.requestcatcher.com/`. **POST** didn't work for some reason and could not get any stream of data back from **Web Client** using DTO classes.
98-
- I Noticed the only difference mainly was headers. Left picture from **ReactorNetty** request and right form **PostMan**, which worked. I tried to change **User-Agent** to `User-Agent: PostmanRuntime/7.42.0` in **ReactorNetty** so it would work, but my luck failed.
97+
- Tool to catch the request were **Request Catcher**, it helped me to distinguish if there were some error in the request what **ReactorNetty** was making. URL of catcher `https://test.requestcatcher.com/`. **POST** didn't work for some reason and could not get any stream of data back from **Web Client** using DTO classes.
98+
- I Noticed the only difference mainly was headers. Left picture from **ReactorNetty** request and right from **PostMan**, which worked. I tried to change **User-Agent** to `User-Agent: PostmanRuntime/7.42.0` in **ReactorNetty** so it would work, but my luck failed.
9999

100100
<p id="error" align="center">
101-
<img src="doneFromNettyHeaders.PNG" style="float:left; margin-right:10px;" width="320" height="100">
102-
<img src="doneFromPostManHeaders.PNG" style="float:left;" width="320" height="100">
101+
<img src="doneFromNettyHeaders.PNG" style="float:left; margin-right:10px;" width="400" height="100">
102+
<img src="doneFromPostManHeaders.PNG" style="float:left;" width="400" height="100">
103103
</p>
104104

105105
- Due to the inspections how PostMan had it working with this API. It had following settings `Accept: */*`.
106106

107-
- Luckily returning `Mono<String>` from **POST** function and changing NettyReactor headers to `"Accept", MediaType.ALL_VALUE` from `"Accept", MediaType.APPLICATION_JSON_VALUE`(since API give JSON), gave me positive surprise.
107+
- Luckily returning `Mono<String>` from **POST** function and changing NettyReactor headers to `"Accept", MediaType.ALL_VALUE` from `"Accept", MediaType.APPLICATION_JSON_VALUE`(since API gives JSON), gave me positive surprise.
108108

109109

110110
```
@@ -124,37 +124,3 @@ docker compose up
124124

125125

126126
</details>
127-
128-
<!--
129-
# Weird Feature 1.
130-
131-
- I came to notice when making **POST** request to the address of `https://countriesnow.space/api/v0.1/countries/population` it would work for **PostMan**, but not for **ReactorNetty**.
132-
133-
- Tool to catch the request were **Request Catcher**, it helped me to distinguish if there were some error in the request what **Netty** was making. URL of catcher `https://test.requestcatcher.com/`. **POST** didn't work for some reason and could not get any stream of data back from **Web Client** using DTO classes.
134-
- I Noticed the only difference mainly was headers. Left picture from **ReactorNetty** request and right form **PostMan**, which worked. I tried to change **User-Agent** to `User-Agent: PostmanRuntime/7.42.0` in **ReactorNetty*' so it would work, but my luck failed.
135-
136-
<p id="error" align="center">
137-
<img src="doneFromNettyHeaders.PNG" style="float:left; margin-right:10px;" width="320" height="100">
138-
<img src="doneFromPostManHeaders.PNG" style="float:left;" width="320" height="100">
139-
</p>
140-
141-
- Due to the inspections how PostMan had it working with this API. It had following settings `Accept: */*`.
142-
143-
- Luckily returning `Mono<String>` from **POST** function and changing NettyReactor headers to `"Accept", MediaType.ALL_VALUE` from `"Accept", MediaType.APPLICATION_JSON_VALUE`(since API give JSON), gave me positive surprise.
144-
145-
146-
```
147-
@Bean
148-
public WebClient webClient(WebClient.Builder builder) {
149-
return builder.defaultHeader(
150-
"Accept", MediaType.ALL_VALUE)
151-
.build();
152-
}
153-
```
154-
155-
- Below positive surprise. I was not crazy and seeing things.
156-
157-
<img src="positveSupriseAboutPOSTapi.PNG" alt="alt text" width="600"/>
158-
159-
- Also, WebClient started to worked normally after right Header information `.doOnSuccess(result -> System.out.println("Response: " + result));` gave me `Response: Moved Permanently. Redirecting to /api/v0.1/countries/population/q?country=Finland`.
160-
-->

0 commit comments

Comments
 (0)