When using Spring WebFlux 5.1.8.RELEASE consider having the following code
ClientResponse response = ...;
ClientResponse wrapped = ClientResponse.from(response)
.body(response.bodyToFlux(DataBuffer.class)
.transform(this.scopePassingTransformer))
.build()
when response contains a custom status code e.g. 499 the DefaultClientResponseBuilder in the constructor uses statusCode(other.statusCode()); and statusCode() throws an exception since it's a custom status code.