Home Reference Source
public class | source

CDPRequestInfo

Represents a request and response

Static Method Summary

Static Public Methods
public static

Create a new RequestInfo from a request that redirected

public static

Create a new RequestInfo from a request

public static

Create a new RequestInfo from a response

Constructor Summary

Public Constructor
public

Construct a new CDPRequestInfo

Member Summary

Public Members
public

Boolean indicating if the response body should be retrieved

public

Boolean indicating if the requests post data should be retrieved

public

The HTTP method used to make this request

public

The post data of the request if any was sent

public

The HTTP protocol used to make this request

public

The request HTTP headers object on the CDP Response object

public

The raw request HTTP header string on the CDP Response object

public

The request HTTP headers object on the CDP Request object

public

The id of the request

public

The response HTTP header object on the CDP Response object

public

The raw response HTTP header string on the CDP Response object

public

The HTTP status of the response

public

The HTTP status reasons text of the response

public get

url: string: *

public

The fragment portion of the requests URL.

Private Members
private

The URL of the request.

Method Summary

Public Methods
public

addResponse(res: Object, not3xx: boolean)

Add the requests response information

public

Determine if we have enough information to serialize the response

public

getParsedURL(): URL

Returns a URL object representing this requests URL

public

Serialize the request headers for the WARC entry

public

Serialize the response headers for the WARC entry

Private Methods
private

Ensure that the request info object has its method property set

private

_correctProtocol(originalProtocol: string): string

Ensure that the request info object has the correct protocol property

private
private

Returns the correct request header object or null if there is none

private

_methProtoFromReqHeadText(requestHeadersText: string)

Set The Requests Method And Protocol From The Request Headers Text

private

Serializes request headers object

private

Returns the request headers text that is replay able

Static Public Methods

public static fromRedir(info: Object): CDPRequestInfo source

Create a new RequestInfo from a request that redirected

Params:

NameTypeAttributeDescription
info Object

The object received from Network.requestWillBeSent

Return:

CDPRequestInfo

public static fromRequest(info: Object): CDPRequestInfo source

Create a new RequestInfo from a request

Params:

NameTypeAttributeDescription
info Object

The object received from Network.requestWillBeSent

Return:

CDPRequestInfo

public static fromResponse(info: Object): CDPRequestInfo source

Create a new RequestInfo from a response

Params:

NameTypeAttributeDescription
info Object

The object received from Network.responseReceived

Return:

CDPRequestInfo

Public Constructors

public constructor() source

Construct a new CDPRequestInfo

Public Members

public getBody: boolean source

Boolean indicating if the response body should be retrieved

public hasPostData: boolean source

Boolean indicating if the requests post data should be retrieved

public method: string source

The HTTP method used to make this request

public postData: string source

The post data of the request if any was sent

public protocol: string source

The HTTP protocol used to make this request

public requestHeaders: Object source

The request HTTP headers object on the CDP Response object

public requestHeadersText: string source

The raw request HTTP header string on the CDP Response object

public requestHeaders_: Object source

The request HTTP headers object on the CDP Request object

public requestId: string source

The id of the request

public responseHeaders: Object source

The response HTTP header object on the CDP Response object

public responseHeadersText: string source

The raw response HTTP header string on the CDP Response object

public status: string | number source

The HTTP status of the response

public statusText: string source

The HTTP status reasons text of the response

public get url: string: * source

Return:

string

public urlFragment: string source

The fragment portion of the requests URL. Only defined if representation of the URL returned by the CDP has this property.

Private Members

private _url: string source

The URL of the request. May not contain the fragment portion of the the URL if it had a fragment depending on if the representation of URL returned by the CDP separates it.

Public Methods

public addResponse(res: Object, not3xx: boolean) source

Add the requests response information

Params:

NameTypeAttributeDescription
res Object

The response object received from Network.responseReceived

not3xx boolean
  • optional
  • default: true

public canSerializeResponse(): boolean source

Determine if we have enough information to serialize the response

Return:

boolean

public getParsedURL(): URL source

Returns a URL object representing this requests URL

Return:

URL

public serializeRequestHeaders(): string source

Serialize the request headers for the WARC entry

Return:

string

public serializeResponseHeaders(): string source

Serialize the response headers for the WARC entry

Return:

string

Private Methods

private _checkMethod() source

Ensure that the request info object has its method property set

private _correctProtocol(originalProtocol: string): string source

Ensure that the request info object has the correct protocol property

Params:

NameTypeAttributeDescription
originalProtocol string

The ordinal protocol of the request

Return:

string

private _ensureProto() source

private _getReqHeaderObj(): Object source

Returns the correct request header object or null if there is none

Return:

Object (nullable: true)

private _methProtoFromReqHeadText(requestHeadersText: string) source

Set The Requests Method And Protocol From The Request Headers Text

Params:

NameTypeAttributeDescription
requestHeadersText string
  • nullable: true

The Full HTTP Headers String

private _serializeRequestHeadersObj(): string source

Serializes request headers object

Return:

string

private _serializeRequestHeadersText(): string source

Returns the request headers text that is replay able

Return:

string