2017-02-06 3 views

답변

1

예, 당신은 ... 당신은 전체 응답 본문에서 전체 요청에 액세스 할 수 있습니다 - 당신은 같은 코드를 통해 액세스 할 수있는 내가

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); 
}); 
관련 문제