Class DefaultHttpRequester
- Namespace
- AngleSharp.Io
- Assembly
- AngleSharp.dll
The default (ready-to-use) HTTP requester.
public sealed class DefaultHttpRequester : BaseRequester, IRequester, IEventTarget
- Inheritance
-
DefaultHttpRequester
- Implements
- Inherited Members
- Extension Methods
Constructors
DefaultHttpRequester(string?, Action<HttpWebRequest>?)
Constructs a default HTTP requester with the information presented in the info object.
public DefaultHttpRequester(string? userAgent = null, Action<HttpWebRequest>? setup = null)
Parameters
userAgent
stringThe user-agent name to use, if any.
setup
Action<HttpWebRequest>An optional setup function for the HttpWebRequest object.
Properties
Headers
Gets the used headers.
public IDictionary<string, string> Headers { get; }
Property Value
Timeout
Gets or sets the timeout value.
public TimeSpan Timeout { get; set; }
Property Value
Methods
PerformRequestAsync(Request, CancellationToken)
Performs an asynchronous http request that can be cancelled.
protected override Task<IResponse?> PerformRequestAsync(Request request, CancellationToken cancellationToken)
Parameters
request
RequestThe options to consider.
cancellationToken
CancellationTokenThe token for cancelling the task.
Returns
SupportsProtocol(string)
Checks if the given protocol is supported.
public override bool SupportsProtocol(string protocol)
Parameters
protocol
stringThe protocol to check for, e.g. http.
Returns
- bool
True if the protocol is supported, otherwise false.