Skip to content

AddHeader

Imports a HTTP header on request.

1
myRestRequest.AddHeader(name: string, value: string):RestRequest

Parameters

string name
    Name of HTTP header

string value
    Value of HTTP header

Remarks

Name and Value arguments are required. Otherwise error is thrown.

Example

1
2
3
4
5
var client = $Rest.Create('https://login.microsoftonline.com/tenant/oauth2/v2.0/token');
var request = client.Request();

request.AddHeader('Content-Type', 'application/x-www-form-urlencoded');
request.AddHeader('Host', 'login.microsoftonline.com');

See Also