V8 Javascript API

http.Request Class Reference

[Http Requests]

Description

Represents a http request.

Properties

Boolean  authenticate_redirects
Whether redirects to other hostnames should have authentication credentials from the original host applied to them. More...
String  body
The http request body to be sent. More...
Integer  connect_timeout
Timeout in seconds for the connection to complete. More...
String  encoding
The encoding used to decode the response body. More...
Boolean  follow_redirects
Whether redirects are automatically followed.
Object  headers
An object whose properties will be the header names sent with the request. More...
Boolean  json
Enables automatic json serialisation of the request body, and json deserialisation of the response body. More...
Array  maintain_request_methods
The redirect codes that will maintain http method when followed. More...
Integer  max_redirects
The maximum number of redirects followed. More...
String  method
The http method to be used. More...
Integer  timeout
Timeout in seconds for the transfer to complete. More...
String  url
The url of the resource being requested.
Boolean  verify_ssl
Whether ssl certificates must be verified for the request to succeed. More...

Properties

Boolean http.​Request.authenticate_redirects

Whether redirects to other hostnames should have authentication credentials from the original host applied to them. Defaults to false.

String http.​Request.body

The http request body to be sent. Strings will be encoded using utf-8. The body may also be provided as a json serialisable Object if json is set to true. ArrayBuffers are also supported and their contents will be sent without encoding.

Integer http.​Request.connect_timeout

Timeout in seconds for the connection to complete. 0 for the default of 300 seconds.

String http.​Request.encoding

The encoding used to decode the response body. Must be one of:

  • 'utf8' : (default) utf-8 string encoding

  • 'utf16le' : utf-16 string encoding

  • 'ucs2' : alias for 'utf16le'

  • 'latin1' : ISO/IEC 8859-1 single byte encoding

  • null : No encoding, body will be returned as a binary ArrayBuffer

Boolean http.​Request.follow_redirects

Whether redirects are automatically followed.

Object http.​Request.headers

An object whose properties will be the header names sent with the request. Each header entry can either be a single String value or an Array of String values in the case that a header occurs multiple times.

Boolean http.​Request.json

Enables automatic json serialisation of the request body, and json deserialisation of the response body. In this mode, the encoding property must be a string based encoding. A null encoding will fall back to utf-8 encoding. If the response object cannot be parsed, a null body value will be returned by the response.

Array http.​Request.maintain_request_methods

The redirect codes that will maintain http method when followed. Each entry must be one of:

  • '301'

  • '302'

  • '303'

Integer http.​Request.max_redirects

The maximum number of redirects followed. -1 for unlimited redirects.

String http.​Request.method

The http method to be used. Must be one of:

  • 'get'

  • 'head'

  • 'post'

  • 'put'

  • 'delete'

  • 'connect'

  • 'options'

  • 'trace'

  • 'patch'

Integer http.​Request.timeout

Timeout in seconds for the transfer to complete. 0 for the default no timeout.

String http.​Request.url

The url of the resource being requested.

Boolean http.​Request.verify_ssl

Whether ssl certificates must be verified for the request to succeed. Defaults to true.