Handle responses to HTTP/HTTPS requests.
This class is not exported from the
'electron' module. It is only available as a return value of other methods in the Electron API.
IncomingMessage implements the Readable Stream
interface and is therefore an EventEmitter.
chunkBuffer - A chunk of response body's data.
data event is the usual method of transferring response data into
Indicates that response body has ended. Must be placed before 'data' event.
Emitted when a request has been canceled during an ongoing HTTP transaction.
error Error - Typically holds an error string identifying failure root cause.
Emitted when an error was encountered while streaming response data events. For
instance, if the server closes the underlying while the response is still
error event will be emitted on the response object and a
event will subsequently follow on the request object.
IncomingMessage instance has the following readable properties:
Integer indicating the HTTP response status code.
string representing the HTTP status message.
Record<string, string | string> representing the HTTP response headers. The
headers object is
formatted as follows:
- All header names are lowercased.
- Duplicates of
set-cookieis always an array. Duplicates are added to the array.
- For duplicate
cookieheaders, the values are joined together with '; '.
- For all other headers, the values are joined together with ', '.
string indicating the HTTP protocol version number. Typical values are '1.0'
or '1.1'. Additionally
httpVersionMinor are two
Integer-valued readable properties that return respectively the HTTP major and
minor version numbers.
Integer indicating the HTTP protocol major version number.
Integer indicating the HTTP protocol minor version number.
string containing the raw HTTP response headers exactly as they were
received. The keys and values are in the same list. It is not a list of
tuples. So, the even-numbered offsets are key values, and the odd-numbered
offsets are the associated values. Header names are not lowercased, and
duplicates are not merged.
// Prints something like:
// [ 'user-agent',
// 'this is invalid because there can be only one',
// '*/*' ]