GetHttpRequestHeader

Description

Gets the HTTP request header. This function is only effective in the installable cloud application deployed with PowerServer.

Applies to

Application object

Syntax

applicationname.GetHttpRequestHeader ( string headerName )

Argument

Description

applicationname

The name of the application object in which you want to get the request header

headerName

A string whose value is the header name


Return value

String.

Returns the information of the HTTP request header if it succeeds and an empty string if the current application is not an installable cloud app deployed with PowerServer.

Examples

The following code example gets the cookie in the HTTP request header:

String ls_Header
ls_Header = GetApplication().GetHttpRequestHeader("cookie")

The following code example gets the cookie in the HTTP request header, sends a request using this cookie and then gets the session count.

String ls_ServerURL, ls_SessionAPI, ls_Cookie, ls_Body
Integer li_Return
HttpClient lhc_client

lhc_client = Create HttpClient

ls_Cookie = GetApplication().GetHttpRequestHeader("cookie")
ls_ServerURL = GetApplication().GetPowerServerURL()
ls_SessionAPI = ls_ServerURL + "/api/session/getsessioncount"

lhc_client.SetRequestHeader("cookie", ls_Cookie)
li_Return = lhc_client.SendRequest("get", ls_SessionAPI)
If li_Return = 1 Then
 lhc_client.GetResponseBody(ls_Body)
End If

See also

BeginSession

SetHttpRequestHeader

GetHttpRequestHeaders