HttpRequest class final

HTTP request.

The task will be pushed to the worker as an HTTP request. If the worker or the redirected worker acknowledges the task by returning a successful HTTP response code (`200` - `299`), the task will be removed from the queue. If any other HTTP response code is returned or no response is received, the task will be retried according to the following:

  • User-specified throttling: google.cloud.tasks.v2.Queue.retry_config, google.cloud.tasks.v2.Queue.rate_limits, and the google.cloud.tasks.v2.Queue.state.

  • System throttling: To prevent the worker from overloading, Cloud Tasks may temporarily reduce the queue's effective rate. User-specified settings will not be changed.

System throttling happens because:

  • Cloud Tasks backs off on all errors. Normally the backoff specified in google.cloud.tasks.v2.Queue.rate_limits will be used. But if the worker returns 429 (Too Many Requests), 503 (Service Unavailable), or the rate of errors is high, Cloud Tasks will use a higher backoff rate. The retry specified in the Retry-After HTTP response header is considered.

  • To prevent traffic spikes and to smooth sudden increases in traffic, dispatches ramp up slowly when the queue is newly created or idle and if large numbers of tasks suddenly become available to dispatch (due to spikes in create task rates, the queue being unpaused, or many tasks that are scheduled at the same time).

Constructors

HttpRequest({required String url, HttpMethod httpMethod = HttpMethod.$default, Map<String, String> headers = const {}, Uint8List? body, OauthToken? oauthToken, OidcToken? oidcToken})
HttpRequest.fromJson(Object? j)
factory

Properties

body → Uint8List
HTTP request body.
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, String>
HTTP request headers.
final
httpMethod → HttpMethod
The HTTP method to use for the request. The default is POST.
final
oauthToken → OauthToken?
If specified, an OAuth token will be generated and attached as an Authorization header in the HTTP request.
final
oidcToken → OidcToken?
If specified, an OIDC token will be generated and attached as an Authorization header in the HTTP request.
final
qualifiedName → String
The fully qualified name of this message, i.e., google.protobuf.Duration or google.rpc.ErrorInfo.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
url → String
Required. The full url path that the request will be sent to.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Object
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

fullyQualifiedName → const String