staticSend static method

Future<Response> staticSend({
  1. required String awsAccessKey,
  2. required String awsSecretKey,
  3. required String region,
  4. required String service,
  5. required AwsRequestType type,
  6. required Future<Response> mockFunction(
    1. Request
    ),
  7. List<String> signedHeaders = const [],
  8. Map<String, String> headers = defaultHeaders,
  9. String jsonBody = '',
  10. String queryPath = '/',
  11. Map<String, String>? queryString,
  12. 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,
  );
}