response.bod" /> response.bod" /> response.bod"/>

Getting Response from Spring Web Client onStatus function

1.1k views Asked by At
WebClient
  .builder()
  .build()
  .post()
  .uri("/some-resource")
  .retrieve()
  .onStatus(
    HttpStatus.INTERNAL_SERVER_ERROR::equals,
    response -> response.bodyToMono(String.class).map(Exception::new))

I'm trying to write some test cases for a function like this in a project that I'm working on. I can't figure out how do I access the response in the onStatus parameters, or how to pass a specific HTTP status code to this onStatus function to be able to simulate the response.

I don't really understand where the onStatus function is getting the HTTP status from, or where it is passing the response to. Am I missing something here?

0

There are 0 answers