hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

hapi-fhir-client-okhttp support for okhttp3 >= 4.0.0 #3725

Open krumboeck opened 2 years ago

krumboeck commented 2 years ago

hapi-fhir-client-okhttp uses internal functions of okhttp which are not exposed after version 4.0.0. Last working okhttp version is 3.14.9 from May 2020.

Please look at: Upgrading to OkHttp 4

Applications fail with:

java.lang.NoSuchMethodError: 'java.lang.String okhttp3.internal.Version.userAgent()'
    at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.addUserAgentHeader(OkHttpRestfulClient.java:130) ~[hapi-fhir-client-okhttp-6.0.1.jar:na]
    at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.addHeadersToRequest(OkHttpRestfulClient.java:123) ~[hapi-fhir-client-okhttp-6.0.1.jar:na]
    at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.initBaseRequest(OkHttpRestfulClient.java:76) ~[hapi-fhir-client-okhttp-6.0.1.jar:na]
    at ca.uhn.fhir.okhttp.client.OkHttpRestfulClient.createGetRequest(OkHttpRestfulClient.java:112) ~[hapi-fhir-client-okhttp-6.0.1.jar:na]
    at ca.uhn.fhir.rest.client.impl.BaseHttpClientInvocation.createHttpRequest(BaseHttpClientInvocation.java:77) ~[hapi-fhir-client-6.0.1.jar:na]
    at ca.uhn.fhir.rest.client.method.HttpGetClientInvocation.asHttpRequest(HttpGetClientInvocation.java:106) ~[hapi-fhir-client-6.0.1.jar:na]
MFAshby commented 2 years ago

This is applied on master already but seems not to be released yet https://github.com/hapifhir/hapi-fhir/commit/e2effc65b823e121a685ba76435f05d3a438f19c