일부 노드 문서를 읽었으며 요청 헤더/본문/데이터가 어떻게 전송되는지 궁금합니다.http 요청 데이터 전송 이해 - nodejs
nodejs의 docs에서 본문을 구문 분석하기위한 샘플 코드를 보여줍니다. 따라서 데이터가 스트리밍되고 각 청크를 구문 분석 할 수있는 문자열로 푸시하면됩니다.
헤더에서 동일한 문제가 발생하지 않는 이유는 무엇입니까? 대신에 직접받을 수 있습니다. 누구나 이것이 왜이 데이터가 전송/수신되는 방식을 설명하는 출처인지 설명 할 수 있습니까?
방법, URL 및 헤더
var headers = request.headers;
var userAgent = headers['user-agent'];
요청 본문
var body = [];
request.on('data', function(chunk) {
body.push(chunk);
}).on('end', function() {
body = Buffer.concat(body).toString();
// at this point, `body` has the entire request body stored in it as a string
});
출처 : https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/