SetRequestHeader

Description

Sets the request header.

Applies to

HTTPClient and RestClient objects

Syntax

objectname.SetRequestHeader ( headerName, headerValue )

Argument

Description

objectname

The name of the HTTPClient or RestClient object in which you want to set the request header

headerName

A string whose value is the header name

headerValue

A string whose value is the header value


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:

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

ClearRequestHeaders

GetRequestHeader

GetRequestHeaders

SetRequestHeaders