Agent
An httpresponse object provides a way for the agent to respond to a single incoming HTTP transaction.
When the HTTP request handler callback registered using http.onrequest() is invoked, a new httpresponse object is automatically instantiated, configured and passed into the callback’s second parameter.
The source of the incoming HTTP request can be contacted immediately, or the httpresponse object can be retained in a global variable or a global collection to allow the response to be sent later, perhaps after data has been collected from the agent’s device.
Errors arising during HTTP transactions will be signalled by a standard HTTP status code. A number of these codes also have special meanings in the context of agent communications. See this HTTP response codes table for a list of these codes and a guide to interpreting them.
The httpresponse object has the following member methods: