SetRequestHeader
PowerScript function
Description
Sets the request header.
Applies to
HTTPClient and RestClient objects
Syntax
|
1 |
objectname.SetRequestHeader ( string headerName, string headerValue{, Boolean replace } ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the HTTPClient or RestClient object in which |
|
headerName |
A string whose value is the header name. |
|
headerValue |
A string whose value is the header value. |
|
replace (optional) |
A boolean determines whether to replace the current
Note: use this argument cautiously (TRUE is recommended) |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any
argument’s value is null, the method returns null.
Examples
This example constructs a GET request which supports all header
settings:
|
1 2 3 4 5 6 7 8 |
HttpClient lnv_HttpClient lnv_HttpClient = Create HttpClient lnv_HttpClient.SetRequestHeader("Accept", "*/*") lnv_HttpClient.SetRequestHeader("Accept-Encoding", "gzip") lnv_HttpClient.SetRequestHeader("Accept-Language", "en") lnv_HttpClient.SetRequestHeader("Connection", "keep-alive") lnv_HttpClient.SetRequestHeader("User-Agent", "Chrome/60.0.3112.113") lnv_HttpClient.SetRequestHeader("Cache-Control", "no-cache") |
See also