programing

Postman-변수가 대체 된 헤더 및 본문 데이터가있는 요청을 보는 방법

nasanasas 2020. 11. 14. 10:18
반응형

Postman-변수가 대체 된 헤더 및 본문 데이터가있는 요청을 보는 방법


Postman Chrome 플러그인을 사용하여 소프트웨어 테스트를위한 HTTP 요청을 호출하고 있습니다. 환경 및 전역 변수와 함께 환경 기능을 사용하여 요청 헤더 및 본문의 변수를 대체합니다.

변수 대체가 올바르게 작동하고 있습니다 (HTTP 서버의 응답에서 알 수 있습니다).

그러나, 나는 헤더와 본문 값 요청 볼 수 있도록하고 싶습니다 AFTER 변수가 대체되고있다. 어떻게 할 수 있습니까?


현재 Postman은 자체 "콘솔"과 함께 제공됩니다. 콘솔을 열려면 왼쪽 하단의 터미널 모양 아이콘을 클릭하십시오. 요청을 보내면 Postman의 콘솔에서 요청을 검사 할 수 있습니다.

여기에 이미지 설명 입력


업데이트 2018-12-12-Chrome 앱 v Chrome 플러그인 -상단의 최신 업데이트

Postman Chrome 앱지원 중단됨에 따라 이제 Postman 기본 앱을 사용한다고 가정 하면 옵션은 다음과 같습니다.

  1. 마우스로 변수 위로 마우스를 가져갑니다.
  2. "코드"버튼 / 링크 생성
  3. 우편 배달부 콘솔

각 옵션에 대한 자세한 내용은 아래를 참조하십시오.

개인적으로, 2) "코드"버튼 / 링크 생성 을 선택하면 실제로 보낼 필요없이 변수를 볼 수 있습니다.

데모 요청 데모 요청

데모 환경 데모 환경

1) 마우스로 변수 위로 마우스를 가져갑니다. 마우스로 변수 위로 마우스를 가져갑니다.

2) "코드"버튼 / 링크 생성 "코드"버튼 / 링크 생성

3) 우편 배달부 콘솔 여기에 이미지 설명 입력

업데이트 : 2016-06-03

Whilst the method described above does work, in practice, I now normally use the "Generate Code" link on the Postman Request screen. The generated code, no matter what code language you choose, contains the substituted variables. Hitting the "Generate Code" link is just faster, additionally, you can see the substituted variables without actually making the request.

Original Answer below

To see the substituted variables in the Headers and Body, you need to use Chrome Developer tools. To enable Chrome Developer Tools from within Postman do the following, as per http://blog.getpostman.com/2015/06/13/debugging-postman-requests/.

I have copied the instructions from the link above in case the link gets broken in the future:

  1. Type chrome://flags inside your Chrome URL window

  2. Search for “packed” or try to find the “Enable debugging for packed apps”

  3. Enable the setting

  4. Restart Chrome

You can access the Developer Tools window by right clicking anywhere inside Postman and selecting “inspect element”. You can also go to chrome://inspect/#apps and then click “inspect” just below requester.html under the Postman heading.

Once enabled, you can use the Network Tools tab for even more information on your requests or the console while writing test scripts. If something goes wrong with your test scripts, it’ll show up here.


If, like me, you are still using the browser version (which will be deprecated soon), have you tried the "Code" button?

여기에 이미지 설명 입력

This should generate a snippet which contains the entire request Postman is firing. You can even choose the language for the snippet. I find it quite handy when I need to debug stuff.

Hope this helps.


I'd like to add complementary information: In postman app you may use the "request" object to see your subsituted input data. (refer to https://www.getpostman.com/docs/postman/scripts/postman_sandbox in paragraph "Request/response related properties", ie.

console.log("header : " + request.headers["Content-Type"]);
console.log("body : " + request.data);
console.log("url : " + request.url);

I didn't test for header substitution but it works for url and body.

Alex


Even though they are separate windows but the request you send from Postman, it's details should be available in network tab of developer tools. Just make sure you are not sending any other http traffic during that time, just for clarity.

참고URL : https://stackoverflow.com/questions/33793629/postman-how-to-see-request-with-headers-and-body-data-with-variables-substitut

반응형