Reputation: 367
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
Upvotes: 10
Views: 3574
Reputation: 2095
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
Upvotes: 1
Reputation: 50983
FYI since okhttp 3.0 or so OkHttp-Selected-Protocol
is not printed.
The protocol can be easily seen in the response object though.
Upvotes: 6
Reputation: 367
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
Upvotes: 1