get, request, header, api, response, send, soap, rest, post, put, delete

Method GetRequestHeader

API

Gets Request Header value which was set manually by user

Watch this video to learn how to use this method

Have a problem with playback?
GetRequestHeader returns request header value The input parameter is string Name The output is string Value or empty if the name not presented Let's use ConcatArrayData API method. We can see there is one record in the headers list Let's output the value to the messagebox Input should be "Header test" Run and we can see output is "abc" as expected.

Usage

Function GetRequestHeader(
    String Name,
    Boolean Report [Optional]
)

GetBookById

ZAP API Method step

GetReq...Header

headerName

True

headerName

Name

Report

Output Parameter

Parameters

Name

Type: String

The name of the Header

Report (optional)

Type: Boolean

Default Value: False

Generate report for this step

Returns

Header value or Empty string if Header is absent

Example

VBScript

Server("API Server").Method("GetBookById").SetRequestHeader "Test", "Unknown header"
' Display header value in message box
msgbox Server("API Server").Method("GetBookById").GetRequestHeader("Test", True)

JavaScript

Server("API Server").Method("GetBookById").SetRequestHeader("Test", "Unknown header");
// Display header value in message box
alert(Server("API Server").Method("GetBookById").GetRequestHeader("Test", true));

GetBookById

ZAP API Method step

SetReq...Header

Test

Unknown header

Script-Less next step

Comment

Display header value in message box

Script-Less next step

GetBookById

ZAP API Method step

GetReq...Header

headerName

True

headerName

Script-Less next step

ZAP Utility

ZAP Utility step

Zap.Comm...Box

Zap.Var...header")

Contact Us

3150 Roswell Rd NW

Atlanta, GA, 30305, USA

(800) 795-3552