BidiHttpRequest
Namespace: PuppeteerSharp.Bidi
public class BidiHttpRequest : Request<BidiHttpResponse>, IRequestSupports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
Inheritance: object → Request<BidiHttpResponse>
Implements: IRequest
Properties
Section titled “Properties”Headers
Section titled “Headers”public override Dictionary<string, string> Headers { get; }Gets the merged headers including extra HTTP headers.
Value: Dictionary<string, string>
InterceptResolutionState
Section titled “InterceptResolutionState”public override InterceptResolutionState InterceptResolutionState { get; }Gets the current intercept resolution state.
Value: InterceptResolutionState
IsInterceptResolutionHandled
Section titled “IsInterceptResolutionHandled”public override bool IsInterceptResolutionHandled { get; protected set; }Gets whether the intercept resolution has already been handled.
Value: bool
Methods
Section titled “Methods”AbortAsync(RequestAbortErrorCode, int?)
Section titled “AbortAsync(RequestAbortErrorCode, int?)”public override Task AbortAsync(RequestAbortErrorCode errorCode = RequestAbortErrorCode.Failed, int? priority = null)Aborts request. To use this, request interception should be enabled with SetRequestInterceptionAsync(bool). Exception is immediately thrown if the request interception is not enabled.
Parameters
| Name | Type | Description |
|---|---|---|
errorCode |
RequestAbortErrorCode | Optional error code. Defaults to Failed. |
priority |
int? | Optional intercept abort priority. If provided, intercept will be resolved using cooperative handling rules. Otherwise, intercept will be resolved immediately. IMPORTANT: If you set the priority, you will need to attach Request listener using Task%7d) instead of Request. |
Returns: Task — Task.
CanBeIntercepted()
Section titled “CanBeIntercepted()”protected override bool CanBeIntercepted()Determines whether this request can be intercepted.
Returns: bool — true if the request can be intercepted; otherwise, false.
ContentAsync()
Section titled “ContentAsync()”public override Task<byte[]> ContentAsync()Fetches the unmodified POST data bytes for the request from the browser.
Returns: Task<byte[]> — Task which resolves to the request’s raw POST data, or null when there is none or fetching it fails.
ContinueAsync(Payload, int?)
Section titled “ContinueAsync(Payload, int?)”public override Task ContinueAsync(Payload payloadOverrides = null, int? priority = null)Continues request with optional request overrides. To use this, request interception should be enabled with SetRequestInterceptionAsync(bool). Exception is immediately thrown if the request interception is not enabled. If the URL is set it won’t perform a redirect. The request will be silently forwarded to the new url. For example, the address bar will show the original url.
Parameters
| Name | Type | Description |
|---|---|---|
payloadOverrides |
Payload | Optional request overwrites. |
priority |
int? | Optional intercept abort priority. If provided, intercept will be resolved using cooperative handling rules. Otherwise, intercept will be resolved immediately. IMPORTANT: If you set the priority, you will need to attach Request listener using Task%7d) instead of Request. |
Returns: Task — Task.
FetchPostDataAsync()
Section titled “FetchPostDataAsync()”public override Task<string> FetchPostDataAsync()Fetches the POST data for the request from the browser.
Returns: Task<string> — Task which resolves to the request’s POST data.
RespondAsync(ResponseData, int?)
Section titled “RespondAsync(ResponseData, int?)”public override Task RespondAsync(ResponseData response, int? priority = null)Fulfills request with given response. To use this, request interception should be enabled with SetRequestInterceptionAsync(bool). Exception is thrown if request interception is not enabled.
Parameters
| Name | Type | Description |
|---|---|---|
response |
ResponseData | Response that will fulfill this request. |
priority |
int? | Optional intercept abort priority. If provided, intercept will be resolved using cooperative handling rules. Otherwise, intercept will be resolved immediately. IMPORTANT: If you set the priority, you will need to attach Request listener using Task%7d) instead of Request. |
Returns: Task — Task.
VerifyInterception()
Section titled “VerifyInterception()”protected override void VerifyInterception()Verifies that request interception is enabled and the request has not been handled yet.
Exceptions
| Type | Condition |
|---|---|
| PuppeteerException | Thrown when interception is not enabled or request is already handled. |
Made with love by Dario Kondratiuk