1

I need to get a response from another service, I do it FeignClient, when more than 100 ids are passed in the request parameters, this error appears. If less than 100 it works fine.

my FeignClient:

@FeignClient(
    name = "${application.camera-service.service-id}",
    url = "${application.camera-service.url}"
)
public interface FeignCameraServiceClient {

    @RequestMapping(
        method = RequestMethod.GET,
        path = "${application.camera-service.path}?id.in={ids}"
    )
    List<CameraResponse> getCameraList(@PathVariable(name = "ids") List<Integer> idList);

}

its method in another service which receives the request:

@GetMapping("/cameras")
public ResponseEntity<List<CameraDTO>> getAllCameras(CameraCriteria criteria) {
    log.debug("REST request to get Cameras by criteria: {}", criteria);

    List<CameraDTO> entityList = cameraQueryService.findByCriteria(criteria, Sort.by("id"));

    return ResponseEntity.ok().body(entityList);
}

I tried to increase parameter in application.yml in both services:

server:
  max-http-header-size: 100KB

but it didn't help. I get error:

Internal Server Error feign.FeignException$BadRequest: [400 Bad Request] during [GET] to [http://cameraservice/api/cameras?id.in=11&id.in=12&id.in=14&id.in=15&...

enter image description here

dependency:

 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>4.0.2</version>
        </dependency>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38

0 Answers0