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

Method SetRequestHeader

API

Sets Request Header value

Watch this video to learn how to use this method

Have a problem with playback?
SetRequestHeader sets request header name and value during the runtime The input parameters are string Name and string Value Let's add a header item to the ConcatArrayData method The name will be "Header test" and the value will be "abc" We will set breakpoint to pause the script execution. Run and we can see new entry appears in the Headers list accorging to our command.

Usage

Function SetRequestHeader(
    String Name,
    String Value
)

GetBookById

ZAP API Method step

SetReq...Header

Test

Unknown...

Name

Value

Parameters

Name

Type: String

The name of the Header

Value

Type: String

The new value to set (must be a string)

Returns

No return value

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")

JavaScript

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

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

Variable

header

ZAP API Method step

GetReq...Header

Test

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