How can I check if okhttp is using http / 2 for the request?

How can I verify that okhttp negotiated http / 2 successfully and was not using https / 1.1 instead? Is there any information in the answer that I can check?

Thanks, -Tony

+3


source to share


2 answers


FYI, since okhttp 3.0 or so OkHttp-Selected-Protocol

doesn't print.

The protocol can be easily seen in the response object.



Protocol in response

+2


source


Ok, I think I got the answer. If I print out the response headers I got this: OkHttp-Selected-Protocol: h2

Am I supposed to assume that it successfully negotiated the response on http / 2?



Thank! -tony

+1


source







All Articles