Node.js http.ClientRequest.maxHeadersCount API
Last Updated :
27 Jan, 2023
The http.ClientRequest.maxHeadersCount is an inbuilt application programming interface of class ClientRequest within http module which is used to get the maximum response headers count Limit.
Syntax:
const request.maxHeadersCount
Parameters: This API does not accept any argument as parameter.
Return Value : This method returns the maximum response headers count Limit.
Example 1:
index.js
const http = require( 'http' );
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type' : 'text/plain' });
res.end( 'okay' );
});
server.listen(3000, '127.0.0.1' , () => {
const options = {
port: 3000,
host: '127.0.0.1' ,
headers: {
'Connection' : 'Upgrade' ,
'Upgrade' : 'websocket'
}
};
const req = http.request(options);
req.maxHeadersCount = 200
const v = req.maxHeadersCount;
console.log( "maxHeadersCount :- " + v)
process.exit(0)
});
|
Output:
Reference: https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_request_maxheaderscount
Share your thoughts in the comments
Please Login to comment...