vijayateke
vijayateke

Reputation: 77

Set the headers for authorization api

I am passing the headers from the response of login API to the next authorized API.

Test plan structure: enter image description here

I have to pass the SRToken, Id1, Id2, and Id3 in the header so, I have added JSON extractor for all these headers and set the values fro them. Below screenshot shows how I have extracted values. Example enter image description here

In this way I have extracted values fro Id1, Id2 and Id3. Then I have used Debug Sampler to view the values are stored? But I am not getting the values here. enter image description here

I have also tried using Regular Expression Extractor enter image description here

Upvotes: 0

Views: 234

Answers (2)

SAIR
SAIR

Reputation: 499

You need to extract based on Response Header field. Use Regular Expression extractor as a child of your Login Sampler [from whose response these fields need to be extracted]. Sample Regular Expression is shown where I am extracting digit [change Regular Expression to (\w+) if you want to extract words. or any regex will work].

Most important here is to select "Field to check as Response Headers"

enter image description here

Upvotes: 1

Ori Marko
Ori Marko

Reputation: 58774

JSON is irrelevant in Headers,

You should use Regular Expression Extractor with Field to check set Request Headers and use regular expression for getting the needed values

Upvotes: 0

Related Questions