VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-http-incomingmessage-aborted-method/

⇱ Node.js http.IncomingMessage.aborted Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js http.IncomingMessage.aborted Method

Last Updated : 5 Apr, 2023

The http.IncomingMessage.aborted is an inbuilt application programming interface of class IncomingMessage within the HTTP module which is used to check if the request has been aborted or not.

Syntax:

const message.aborted

Parameters: This method does not accept any argument as a parameter.

Return Value: This method returns true if and only if the request has been aborted.

Example 1: Filename: index.js

Run the index.js file using the following command.

node index.js

Output:

Server is running at port 3000...
displaying the result...
server is closed

Now go to http://localhost:3000/ in the browser, and you will see the following output:

request has been aborted : false

Example 2: Filename: index.js

Run the index.js file using the following command.

node index.js

Output:

Server is running at port 3000...
displaying the result...
server is closed

Now go to http://localhost:3000/ in the browser, and you will see the following output:

request has been aborted : false

Reference: https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_message_aborted

Comment

Explore