Node.js http.ClientRequest.method API Last Updated : 24 Sep, 2021 Comments Improve Suggest changes Like Article Like Report The http.ClientRequest.method is an inbuilt application programming interface of class ClientRequest within http module which is used to get the object of client request method. Syntax: const request.method Parameters: This API does not accept any argument as parameter. Return Value : This method returns the object of client request method. Example 1: index.js // Node.js program to demonstrate the // request.method APi // Importing http module const http = require('http'); // Create an HTTP server const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('okay'); }); // Now that server is running server.listen(3000, '127.0.0.1', () => { // make a request const options = { port: 3000, host: '127.0.0.1', headers: { 'Connection': 'Upgrade', 'Upgrade': 'websocket' } }; // getting client request const req = http.request(options); // getting method // by using method api const v = req.method; // display the result console.log("method :- " + v) process.exit(0) }); Output: Reference: https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_request_method Comment More infoAdvertise with us Next Article Node.js http.ClientRequest.method API rohitprasad3 Follow Improve Article Tags : Web Technologies Node.js NodeJS-API Similar Reads Node.js http.ClientRequest.abort() Method The http.ClientRequest.abort() is an inbuilt application programming interface of class Client Request within http module which is used to abort the client request. Syntax: ClientRequest.abort() Parameters: This method does not accept any argument as a parameter. Return Value: This method does not r 2 min read Node.js http.ClientRequest.end() API The http.ClientRequest.end() is  an inbuilt application programming interface of class ClientRequest within http module which is used to finish sending the request. If any parts of the body are unsent. Syntax: const request.end([data[, encoding]][, callback]) Parameters: This method takes the data a 2 min read Node.js http.ClientRequest.protocol Method The http.ClientRequest.protocol is an inbuilt application programming interface of class ClientRequest within the HTTP module which is used to get the object of client request protocol. Syntax: const request.protocolParameters: This function does not accept any argument as a parameter. Return Value: 2 min read Node.js http.ClientRequest.host API The http.ClientRequest.host is an inbuilt API : Application Programming Interface of class ClientRequest within http module which is used to get the object of client request host. Syntax: const request.host Parameters: This API does not accept any argument as parameter. Return Value : This method re 1 min read Node.js http.ClientRequest.setHeader() Method The http.ClientRequest.setHeader() is an inbuilt application programming interface of class ClientRequest within the HTTP module which is used to set the object of the header. Syntax: const request.setHeader(name, value)Parameters: This method takes the name and value of the particular header as a p 2 min read Node.js http.ClientRequest.maxHeadersCount API 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. Retur 1 min read Node.js http.ClientRequest.setNoDelay() Method The http.ClientRequest.setNoDelay() is an inbuilt application programming interface of class ClientRequest within HTTP module which is used to set the socket such as delaying of excessive requests while requests are being limited is not desired. Syntax: const request.setNoDelay([noDelay])Parameters: 2 min read Node.js http.ClientRequest.setTimeout() Method The http.ClientRequest.setTimeout() is an inbuilt application programming interface of class ClientRequest within the HTTP module which is used to set the request time out for the client request. Syntax: request.setTimeout(timeout[, callback])Parameters: This method takes the time out value as a par 2 min read Node.js http.ClientRequest.removeHeader() Method The http.ClientRequest.removeHeader() is an inbuilt application programming interface of class ClientRequest within the HTTP module which is used to remove a header that's already defined into the headers object. Syntax: const request.removeHeader(name)Parameters: This method takes the name of the h 2 min read Node.js http.ClientRequest.writableEnded API The http.ClientRequest.writableEnded is an inbuilt application programming interface of class ClientRequest within http module which is used to check if the request.end() has been called or not. Syntax: const request.writableEnded Parameters: This API does not accept any argument as parameter. Retur 1 min read Like