Skip to content

HttpSessionBrowserProvider

Category: Web

Source: http_session_browser_provider.dart

Classes

HttpSessionRequest

A single HTTP call against a cloud browser provider's session API.

Used both to create a session (the POST in [HttpSessionBrowserProvider .provision]) and to release it (the request returned in [HttpSessionResult.closeRequest]).

Constructor

dart
HttpSessionRequest({
    required this.method,
    required this.url,
    required this.headers,
    this.body,
  })

Properties

PropertyTypeDescription
methodString
urlUri
headersMap<String, String>
bodyObject?JSON body for the request, if any. Encoded with [jsonEncode].

HttpSessionResult

The provisioned endpoint details a provider extracts from its session-creation response.

Constructor

dart
HttpSessionResult({required this.cdpWsUrl, this.viewUrl, this.closeRequest})

Properties

PropertyTypeDescription
cdpWsUrlString
viewUrlString?
closeRequestHttpSessionRequest?Request issued (best-effort) to release the session on close.

abstract HttpSessionBrowserProvider

Shared base for cloud browser providers that provision a CDP endpoint by POSTing to an HTTP session API.

Owns the apiKey configuration guard and the shared POST / status-check / close plumbing. Subclasses supply only their endpoint, headers, request body, and response mapping via [createRequest] and [mapResponse].

Constructor

dart
HttpSessionBrowserProvider({required this.apiKey, http.Client? client})

Properties

PropertyTypeDescription
apiKeyString?
labelString getHuman-readable provider label used in error messages (e.g. 'Anchor', 'Hyperbrowser').
notConfiguredReasonString getReason appended after the label when [isConfigured] is false, e.g. 'API key not configured'.
isConfiguredbool get
labelString getHuman-readable provider label used in error messages (e.g. 'Anchor', 'Hyperbrowser').
notConfiguredReasonString getReason appended after the label when [isConfigured] is false, e.g. 'API key not configured'.
isConfiguredbool get

Methods

HttpSessionRequest createRequest()

The request that creates a session.

HttpSessionResult mapResponse(Map<String, dynamic> json)

Map the decoded session-creation response into endpoint details.

Future<BrowserEndpoint> provision()

Released under the MIT License.