簡體   English   中英

在 https 發布請求中,clientRequest 和 response object 有什么區別?

[英]What is the difference between clientRequest and response object in an https post request?

我正在嘗試在外部服務器上發出 https 發布請求,並且對 clientRequest 和響應參數的不同之處感到困惑:

const options =
{
   method : "POST",
   auth : "api-key-here"
};

const x = https.request(url, options, function(request,response)
{
   // some code
});

// x is the clientRequest
x.write(someData);

x.end();

我知道響應是服務器在發出請求時發回的內容。 但是,什么是clientRequest? 除了響應之外,https.request function 還會發送它嗎? 如果是,那么它們之間有什么區別?

變量“x”即您的“clientRequest”是您正在創建的請求,而“request”參數用於存儲和顯示該請求的結果。 您可以在以下位置找到更多信息: https://nodejs.org/api/http.html#http_http

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM