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
UrlThe resource's url.
Properties
Body
Gets or sets the stream of the request's body.
public Stream Body { get; set; }
Property Value
Headers
Gets a list of headers (key-values) that should be used.
public Dictionary<string, string> Headers { get; }
Property Value
Method
Gets or sets the method to use.
public HttpMethod Method { get; set; }
Property Value
MimeType
Gets or sets the mime-type to use, if any.
public string? MimeType { get; set; }
Property Value
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
Source
Gets or sets the source of the request, if any.
public INode? Source { get; set; }
Property Value
Target
Gets the target of the request.
public Url Target { get; }
Property Value
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
UrlThe target to use.
source
INodeThe optional source of the request.
referer
stringThe 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
UrlThe target to use.
body
StreamThe body of the request.
type
stringThe type of the request's body.
source
INodeThe optional source of the request.
referer
stringThe 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
UrlThe 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
UrlThe target to use.
fields
IDictionary<string, string>The fields to send.
Returns
- DocumentRequest
The new document request.