2
이 질문에 관해서 : Transfer/pass cookies from one request to another in nodejs/protractornode.js에서 서버로 보낸 요청을 보는 방법은 무엇입니까?
나는 또 하나를 얻었다. nodej를 통해 수행중인 전체 요청 (헤더 + 본문)은 어떻게 볼 수 있습니까?
이 질문에 관해서 : Transfer/pass cookies from one request to another in nodejs/protractornode.js에서 서버로 보낸 요청을 보는 방법은 무엇입니까?
나는 또 하나를 얻었다. nodej를 통해 수행중인 전체 요청 (헤더 + 본문)은 어떻게 볼 수 있습니까?
예, 당신은 ... 당신은 전체 응답 본문에서 전체 요청에 액세스 할 수 있습니다 - 당신은 같은 코드를 통해 액세스 할 수있는 내가
IncomingMessage
ReadableState
headers(ResponseHeaders)
rawHeaders
request - //This is what you need
headers
body
body(Response Body)
아래 그림과 일반적인 전체 응답 구조를 가지고 response.request
을 아래에 표시
var request = require("request");
var options = { method: 'POST',
url: 'http://1.1.1.1/login',
headers:
{ 'cache-control': 'no-cache',
'content-type': 'application/json' },
body: { email: '[email protected]', password: '[email protected]' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
// This will give you complete request
console.log(response.request);
//This gives you the headers from Request
console.log(response.request.headers);
});