How can I verify that okhttp negotiated http/2 successfully and did not use https/1.1 instead? Is there some info in the response I can check?
Thanks, -Tony
How can I verify that okhttp negotiated http/2 successfully and did not use https/1.1 instead? Is there some info in the response I can check?
Thanks, -Tony
FYI since okhttp 3.0 or so OkHttp-Selected-Protocol
is not printed.
The protocol can be easily seen in the response object though.
Ok I think I got the answer. If I print out the response headers I got this: OkHttp-Selected-Protocol: h2
Am I to assume it negotiated successfully the response for http/2?
Thanks! -tony
You can check protocol by calling:
Response response = client.newCall(request).execute(); // first get response from server
Protocol protocol = response.protocol(); // check which protocol was used
© 2022 - 2024 — McMap. All rights reserved.
response.protocol()
in it. square.github.io/okhttp/interceptors – Lethalethal