postman Pre-request Script 发送请求
发送get请求 var host = pm.environment.get("host" ); const csrfTokenServlet = { url: `https: // ${host}/{path}?csrfType=test`, method: 'GET' }; pm.sendRequest(csrfTokenServlet, (err, response) => { if (err) { console.log(err); } else { pm.environment.set( "csrfToken", response.json()['data' ]); console.log(response.json()[ 'data' ]) } }); 发送post请求 # content-type/x-www-form-urlencoded var host = pm.environment.get("host" ); var data = { "organCode":"10000065" , } const postRequest = { url: `https: // ${host}/${path}`, method: 'POST' , header: 'Content-Type:application/x-www-form-urlencoded' , body: