当前位置:网站首页>Postman extracts the token parameter value in the response header and sets it as an environment variable, with code attached
Postman extracts the token parameter value in the response header and sets it as an environment variable, with code attached
2022-07-24 07:39:00 【DrMaker】
Preface
One app When the background interface is tested , To get the current user token, And add header data , Don't talk much , Start demonstration .
Start the operation
Follow the steps in the picture 1.2… Click here to add access_token
Click. 2 Post pop-up editing 
Fill in the interface and data you want and run Just set it to the environment you need , Comment out unnecessary 
Finished log Log output 
End and code
pm.test(" Get the response header token Write to the current environment ", function () {
var access_token = postman.getResponseHeader("X-game-Token");
// Set to environment variable
pm.environment.set("access_token",access_token);
// Set to global variable
// pm.environment.set("access_token",access_token);
console.log(" Login setting variables access_token success :"+access_token)
});
边栏推荐
猜你喜欢

Kali安装pip以及pip换源

Appium use

Jackson parsing JSON detailed tutorial

JS_ Realize the separation of multiple lines of text into an array according to the newline

Jenkins 详细部署

Introduction to C language II. Functions

mysql查询当前节点的所有父级

从零开始C语言精讲篇3:函数

Mitre att & CK ultra detailed learning notes-02 (a large number of cases)

Reptile learning - Overview
随机推荐
InjectFix原理学习(实现修复加法的热更)
Advanced part of C language IV. detailed explanation of user-defined types
剑指offer专项突击版第8天
PHP link log scheme
[cloud native] MySQL index analysis and query optimization
Using depth and normal textures in unity
Introduction to C language v First understanding pointer VI. first understanding structure
【Pytorch】conv2d torchvision.transforms
Simple installation of sqli Labs
给一个字符串 ① 请统计出其中每一个字母出现的次数② 请打印出字母次数最多的那一对
C language advanced part II Pointer
爬虫学习-概述
numpy.arange
Who can stand it when the project goes online
23. Component customization events
Development system selection route
25.消息订阅与发布——PubSub-js
Arduino's super power-saving sleep mode has worked with one 18650 battery for 17 years
Learning notes - distributed transaction theory
Buffer overflow vulnerability of network security module B in national vocational college skills competition