GetHttpVersion

Description

Gets the HTTP protocol version used in communication. This function should be used only when the request is sent successfully, otherwise, the protocol version returned is not the actual protocol version.

Applies to

HTTPClient, RestClient, TokenResponse, ResourceResponse objects

Syntax

objectname.GetHttpVersion ( )

Argument

Description

objectname

The name of the object for which you want to get the HTTP protocol version.


Return value

String.

Returns the version of the HTTP protocol currently in use.

"HTTP 1.1" -- The protocol currently used is HTTP 1.1.

"HTTP 2.0" -- The protocol currently used is HTTP 2.0.

Examples

This example gets the HTTP protocol version through an HTTPClient object:

l_httpclient.enableHttp2= true
l_httpclient.SendRequest("GET", "https://test.appeon.com")
ls_version = l_httpclient.GetHttpVersion()
if ls_version = "HTTP 2.0" Then
  // …
End If

This example gets the HTTP protocol version through a RESTClient object:

l_restclient.enableHttp2= true
l_restclient.SendGetRequest("https://test.appeon.com")
ls_version = l_restclient.GetHttpVersion()
if ls_version = "HTTP 2.0" Then
  // …
End If

This example gets the HTTP protocol version through a TokenResponse object:

ln_rtn = inv_OAuthClient.AccessToken(lnv_TokenRequest, lnv_TokenResponse)
ls_version = lnv_TokenResponse.GetHttpVersion()
if ls_version = "HTTP 2.0" Then
  // …
End If

This example gets the HTTP protocol version through a ResourceResponse object:

ln_rtn = inv_OAuthClient.RequestResource(lnv_OAuthRequest, lnv_ResourceResponse)
ls_version = lnv_ResourceResponse.GetHttpVersion()
if ls_version = "HTTP 2.0" Then
  // …
End If