![]() |
VOOZH | about |
The httpServerResponse.statusMessage is an inbuilt application programming interface of class ServerResponse within http module which is used to control the status message that will be sent to the client when the headers get flushed.
Syntax:
response.statusMessage
Parameters: This method does not accept any arguments as a parameter.
Return Value: This method returns the status message that will be sent to the client.
Example 1: Filename: index.js
Run the index.js file using the below command:
node index.js
Console output:
Server is running at port 3000... status message : OK displaying the result... server is closed
Example 2: Filename: index.js
Run the index.js file using the below command:
node index.js
Console output:
Server is running at port 3000... status message : OK displaying the result... server is closed
Browser output:
hello world
Reference:https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_response_statusmessage