Table of Contents

Class DocumentRequest

Namespace
AngleSharp.Io
Assembly
AngleSharp.dll

Represents the arguments to load a document.

public class DocumentRequest
Inheritance
DocumentRequest
Inherited Members
Extension Methods

Constructors

DocumentRequest(Url)

Creates a new document request for the given url.

public DocumentRequest(Url target)

Parameters

target Url

The resource's url.

Properties

Body

Gets or sets the stream of the request's body.

public Stream Body { get; set; }

Property Value

Stream

Headers

Gets a list of headers (key-values) that should be used.

public Dictionary<string, string> Headers { get; }

Property Value

Dictionary<string, string>

Method

Gets or sets the method to use.

public HttpMethod Method { get; set; }

Property Value

HttpMethod

MimeType

Gets or sets the mime-type to use, if any.

public string? MimeType { get; set; }

Property Value

string

Referer

Gets or sets the referrer of the request, if any. The name is intentionally spelled wrong, to emphasize the relationship with the HTTP header.

public string? Referer { get; set; }

Property Value

string

Source

Gets or sets the source of the request, if any.

public INode? Source { get; set; }

Property Value

INode

Target

Gets the target of the request.

public Url Target { get; }

Property Value

Url

Methods

Get(Url, INode?, string?)

Creates a GET request for the given target from the optional source node and optional referer string.

public static DocumentRequest Get(Url target, INode? source = null, string? referer = null)

Parameters

target Url

The target to use.

source INode

The optional source of the request.

referer string

The optional referrer string.

Returns

DocumentRequest

The new document request.

Post(Url, Stream, string, INode?, string?)

Creates a POST request for the given target with the provided body and encoding type from the optional source node and optional referer string.

public static DocumentRequest Post(Url target, Stream body, string type, INode? source = null, string? referer = null)

Parameters

target Url

The target to use.

body Stream

The body of the request.

type string

The type of the request's body.

source INode

The optional source of the request.

referer string

The optional referrer string.

Returns

DocumentRequest

The new document request.

PostAsPlaintext(Url, IDictionary<string, string>)

Creates a POST request for the given target with the fields being used to generate the body and encoding type plaintext.

public static DocumentRequest PostAsPlaintext(Url target, IDictionary<string, string> fields)

Parameters

target Url

The target to use.

fields IDictionary<string, string>

The fields to send.

Returns

DocumentRequest

The new document request.

PostAsUrlencoded(Url, IDictionary<string, string>)

Creates a POST request for the given target with the fields being used to generate the body and encoding type url encoded.

public static DocumentRequest PostAsUrlencoded(Url target, IDictionary<string, string> fields)

Parameters

target Url

The target to use.

fields IDictionary<string, string>

The fields to send.

Returns

DocumentRequest

The new document request.