URLConnection.RequestHeader

From Xojo Documentation

Method

URLConnection.RequestHeader(name As String) As String

Supported for all project types and targets.

Gets the request header with the key of name. The Name parameter's encoding is converted to ASCII. If the header does not exist in the request headers, an empty String is returned. Raises a RuntimeException if the encoding could not be converted to ASCII.


Method

URLConnection.RequestHeader(name As String, Assigns value As String)

Supported for all project types and targets.

Sets the request header with the key of name. The Name parameter's encoding is converted to ASCII.

Parameters

Parameter Description
name The name of the key to get or set.
value The value for the key.

Sample Code

Sets an API key as a token in the request header:

Self.RequestHeader("Authorization") = "MyAPIKey"
mySocket.Send("GET", "http://www.webservice.com/GetData")