Share this page

# web.utilSetRequestHeader

Asynchronous Functions - JavaScript

Sets a string defining the request header and value for the next request sent in the Conversation An Asynchronous Conversation is a series of related web tasks, including tasks caused by redirection. An Asynchronous Conversation starts with the request for the desired response, includes all the requests and responses that are caused by this request (authentication, redirection, and so on) and ends when the desired response is received or when the series of interactions is canceled..

## Syntax

                web.utilSetRequestHeader ( <header>,<content> );

Argument | Description
--- | ---
header | The new request header, for example, "Accept–Encoding".
content | The request header value.

## Return Values

Not applicable

## Parameterization

The following argument(s) can be parameterized using standard parameterization: header, content

## General Information

This is a utility function that can be called from callback routine Request Callback.

See Also

## Example

    web.utilSetRequestHeader("Accept-Encoding", "gzip");

## xample: Asynchronous Conversations

Copy code

    //Automatically generated file for implementing asynchronous callback functions.
    //You can modify the automatically generated callback implementations or add new ones.
    //Asynchronous callback functions can be registered using web_reg_async_attributes steps.
                function Push_0_RequestCB()
                {

                lr.outputMessage(">>> Push_0_RequestCB");

                }

                function Push_0_ResponseHeadersCB(
                aHttpStatusCode,
                aAccumulatedHeadersStr,
                aAccumulatedHeadersLen)
                {
                //Enter your implementation for ResponseHeadersCB() here.

                lr.outputMessage(">>> Push_0_ResponseHeadersCB " + aHttpStatusCode + " / "
                + aAccumulatedHeadersStr.substr(0, 10) + " / "
                + aAccumulatedHeadersLen);

                }

                function Push_0_ResponseBodyBufferCB(
                aLastBufferStr,
                aLastBufferLen,
                aAccumulatedStr,
                aAccumulatedLen,
                aHttpStatusCode)
                {
                //Enter your implementation for ResponseBodyBufferCB() here.

                lr.outputMessage(">>> Push_0_ResponseBodyBufferCB "  + aLastBufferStr.substr(0, 20)
                + " / " + aLastBufferLen + " / " + aAccumulatedStr.substr(0, 20)
                + " / " + aAccumulatedLen + " / " + aHttpStatusCode);

                }

                function Push_0_ResponseCB(
                aResponseHeadersStr,
                aResponseHeadersLen,
                aResponseBodyStr,
                aResponseBodyLen,
                aHttpStatusCode)
                {
                //Enter your implementation for ResponseCB() here.

                //TODO - To make the script wait for a specific response, use web_sync in the relevant Action file.
                //See the Modifying Callbacks section in the VuGen Help Center for more details.
                lr.outputMessage(">>> Push_0_ResponseCB " + aResponseHeadersStr.substr(0, 20) + " / "
                + aResponseHeadersLen + " / " + aResponseBodyStr.substr(0, 20) + " / "
                + aResponseBodyLen + " / " + aHttpStatusCode);

                }

                function Action()
                {

                web.regAsyncAttributes(
                {
                id: "Push_0",
                pattern: "Push",
                url: "http://myserver.abc.com/cgi-bin/nph-pushJS_FF.exe",
                //requestCB: =Push_0_RequestCB",
                responseHeadersCB:    'Push_0_ResponseHeadersCB',
                responseBodyBufferCB:
                function Push_0_ResponseBodyBufferCB(
                aLastBufferStr,
                aLastBufferLen,
                aAccumulatedStr,
                aAccumulatedLen,
                aHttpStatusCode)
                {
                //Enter your implementation for ResponseBodyBufferCB() here.
                lr.outputMessage(">>> Push_0_ResponseBodyBufferCB " + aLastBufferStr.substr(0, 20)
                + " / " + aLastBufferLen + " / " + aAccumulatedStr.substr(0, 20)
                + " / " + aAccumulatedLen + " / " + aHttpStatusCode);
                }
                });

                web.url(
                {
                name: "push_to_iframe_new_object_FF.html",
                url: "http://myserver.abc.com/webgui/push/push_to_iframe_new_object_FF.html",
                resource: "0",
                recContentType: "text/html",
                snapshot: "t1.inf",
                mode: "HTML",
                });

                lr.thinkTime(30);
                web.stopAsync("Push_0");

                return 1
                }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: