Class: ClientRequest

http-client~ClientRequest

new ClientRequest(options, responseCallback)

Constructor for the object type returned by the request() function. This object type provides the following functions:

  • end(): Call this to end the request.
  • write(''data'', ''encoding''): FIXME: Not supported by this module! In other hosts, writes data (e.g. for a POST request).
The request will not be issued until you call end(). See the documentation of the request function for an explanation of the arguments. This is an event emitter that emits the following events:
  • 'error': If an error occurs. The message is passed as an argument.
  • 'response': A response is received from the server. This event is automatically handled by calling responseCallback, if responseCallback is not null.

Parameters:
Name Type Description
options

The options.

responseCallback

The callback function to call with an instance of IncomingMessage, or with a null argument to signal an error.

Source:

Methods

_handleError(message)

Internal function used to handle an error.

Parameters:
Name Type Description
message

The error message.

Source:

_handleError(message)

Internal function used to handle an error.

Parameters:
Name Type Description
message

The error message.

Source:

end()

Issue the request.

Source:

end()

Issue the request.

Source:

stop()

Once request queueing is implemented, this method should discard any pending submitted jobs and reset the sequence number to zero.

Source:

http-client~ClientRequest

new ClientRequest(options, responseCallback)

Constructor for the object type returned by the request() function. This object type provides the following functions:

  • end(): Call this to end the request.
  • write(''data'', ''encoding''): FIXME: Not supported by this module! In other hosts, writes data (e.g. for a POST request).
The request will not be issued until you call end(). See the documentation of the request function for an explanation of the arguments. This is an event emitter that emits the following events:
  • 'error': If an error occurs. The message is passed as an argument.
  • 'response': A response is received from the server. This event is automatically handled by calling responseCallback, if responseCallback is not null.

Parameters:
Name Type Description
options

The options.

responseCallback

The callback function to call with an instance of IncomingMessage, or with a null argument to signal an error.

Source:

Methods

_handleError(message)

Internal function used to handle an error.

Parameters:
Name Type Description
message

The error message.

Source:

_handleError(message)

Internal function used to handle an error.

Parameters:
Name Type Description
message

The error message.

Source:

end()

Issue the request.

Source:

end()

Issue the request.

Source:

stop()

Once request queueing is implemented, this method should discard any pending submitted jobs and reset the sequence number to zero.

Source: