http4s-jdk-http-client
http4s-jdk-http-client copied to clipboard
`NullPointerException` when `HttpResponse.body()` is `null`
Description
When using the http4s JDK HTTP client, a NullPointerException is thrown if the HttpResponse.body() is null.
This can occur, for example, when a proxy returns 407 Proxy Authentication Required.
Reference: org/http4s/jdkhttpclient/JdkHttpClient.scala#L196
Stacktrace:
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Flow$Publisher.subscribe(java.util.concurrent.Flow$Subscriber)" because the return value of "java.net.http.HttpResponse.body()" is null
at org.http4s.jdkhttpclient.JdkHttpClient$.$anonfun$apply$9(JdkHttpClient.scala:196)
at delay @ org.http4s.jdkhttpclient.JdkHttpClient$.$anonfun$apply$8(JdkHttpClient.scala:196)
at tryGet @ org.http4s.jdkhttpclient.JdkHttpClient$.$anonfun$apply$7(JdkHttpClient.scala:183)
at flatMap @ org.http4s.jdkhttpclient.JdkHttpClient$.$anonfun$apply$7(JdkHttpClient.scala:183)
...
at parallel @ fs2.interop.flow.StreamPublisher$.apply(StreamPublisher.scala:92)