Class: OngoingRequest

lib/ongoingrequest.OngoingRequest

new OngoingRequest(options)

Represents an incoming or outgoing request.
Extends:
Parameters:
Name Type Description
options module:lib/ongoingrequest~OngoingRequestOptions Specifies the channel, direction
Source:

Extends

Members

charset :string

Type:
  • string
Default Value:
  • "UTF-8"
Source:

(nullable) content :Object|string

Read and set the content. The reading part is not reliable for incoming requests, due to the content's streaming nature. Consider the processContent callback as an alternative. The content can be set to an SDK buffer, TypedArrays, ArrayBuffers, any string, object or a nsIInputStream directly. The returned value will always be parsed to a string by default. If the stream is outgoing and the content type contains "json" it will be parsed to an object.
Type:
  • Object | string
Source:

(readonly) direction :module:requestmod.INCOMING|module:requestmod.OUTGOING

Direction of the request.
Type:
Source:

(readonly) headers :module:lib/headers.Headers

Access and modify request headers.
Type:
Source:

method :string

The request method.
Type:
  • string
Source:

(nullable) notCached :boolean

Is true if the request is for sure not cached, else null. (not false, as it's not sure that it is in fact coming from the cache).
Type:
  • boolean
Source:

referrer :string

Referer of the request.
Type:
  • string
Source:

(readonly) status :number

The request status code
Type:
  • number
Source:

type :string

Content Type.
Type:
  • string
Default Value:
  • "text/plain"
Source:

url :string

The URL of the request. Setting this property factually redirects the request to a different URL, opening a new request.
Type:
  • string
Source:

Methods

abort()

Abort the request immediately.
Source:

processContent()

Allows to process the full content into new content, however the callback is possibly executed asynchronously and the `OngoingRequest` object might have been destroyed by then.
Parameters:
Type Description
module:lib/ongoingrequest~processContentCallback
Source: