staticSend static method
Future<Response>
staticSend({
- required String awsAccessKey,
- required String awsSecretKey,
- required String region,
- required String service,
- required AwsRequestType type,
- required Future<
Response> mockFunction(- Request
- List<
String> signedHeaders = const [], - Map<
String, String> headers = defaultHeaders, - String jsonBody = '',
- String queryPath = '/',
- Map<
String, String> ? queryString, - Duration timeout = const Duration(seconds: 10),
Statically Builds, signs, and mocks an aws http request.
type: request type GET, POST, PUT, etc
service: aws service you are sending request to
signedHeaders: a list of headers aws requires in the signature.
Default included signed headers are: content-type, host, x-amz-date
(You do not need to provide these in headers)
headers: any required headers. Any non-default headers included in the signedHeaders must be added here.
jsonBody: the body of the request, formatted as json
queryPath: the aws query path
queryString: the aws query string, formatted like 'abc=123&def=456'
. Must be url encoded
Implementation
static Future<Response> staticSend({
required String awsAccessKey,
required String awsSecretKey,
required String region,
required String service,
required AwsRequestType type,
required Future<Response> Function(Request) mockFunction,
List<String> signedHeaders = const [],
Map<String, String> headers = defaultHeaders,
String jsonBody = '',
String queryPath = '/',
Map<String, String>? queryString,
Duration timeout = const Duration(seconds: 10),
}) async {
return AwsHttpRequest.send(
awsAccessKey: awsAccessKey,
awsSecretKey: awsSecretKey,
region: region,
type: type,
service: service,
signedHeaders: signedHeaders,
headers: headers,
jsonBody: jsonBody,
canonicalUri: queryPath,
canonicalQuery: queryString,
timeout: timeout,
mockRequest: true,
mockFunction: mockFunction,
);
}