So I have 5 microservices running on different ports. I have a service called the movie-catalogue-service and I try to retrieve ratings from Movies by id which are passed via request parameters. I have a discovery server running aswell, which works fine.
My endpoint of my function looks like this:
@GetMapping("/test")
    fun testFun(@RequestParam movieIds:List<String>) : Flux<Rating> {
        return movieCatalogService.findRatingByMovieId(movieIds)
    }
My findRatingByMovieId looks like this:
fun findRatingByMovieId(movieIds: List<String>) : Flux<Rating> {
        return webClient.build()
            .get()
            .uri { uribuilder ->
                uribuilder.path("http://ratings-data-service/ratings/list")
                    .queryParam("movieIds", movieIds)
                    .build()
            }
            .retrieve()
            .bodyToFlux(Rating::class.java)
    }
My endpoint of my ratings-data-service looks like this:
@GetMapping("/list")
    fun findRatingsByMovieIds(@RequestParam movieIds:List<String>) : Flux<Rating> {
        return ratingsDataService.findRatingsByMovieId(movieIds)
    }
And the service function:
 fun findRatingsByMovieId(movieIds:List<String>) : Flux<Rating> {
        return ratingsDataRepository.findAllById(movieIds)
    }
When sending a request to localhost:8080/catalog/test?movieIds=6076bd2aa35f61406db0da84&movieIds=6076bd48a35f61406db0da85
I get the error in the
IntelliJ console like this:
400 Bad Request from UNKNOWN 
    at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:179) ~[spring-webflux-5.3.5.jar:5.3.5]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
    |_ checkpoint ⇢ 400 from GET localhost:7654/ratings/list?movieIds=6076bd2aa35f61406db0da84&movieIds=6076bd48a35f61406db0da85 [DefaultWebClient]
    |_ checkpoint ⇢ Handler io.eraslan.moviecatalogservice.controller.MovieCatalogController#testFun(List) [DispatcherHandler]
    |_ checkpoint ⇢ HTTP GET "/catalog/test?movieIds=6076bd2aa35f61406db0da84&movieIds=6076bd48a35f61406db0da85" [ExceptionHandlingWebHandler]
When I directly call the ratings-data-service endpoint:
localhost:7654/ratings/list?movieIds=6076bd2aa35f61406db0da84&movieIds=6076bd48a35f61406db0da85
everything works fine, how is this possible ?