AWSRequest.json constructor
AWSRequest.json()
Creates a new HTTP request with json payload
based on body
argument.
It automatically sets content-type
header value
to application/json; charset=UTF-8
.
Implementation
factory AWSRequest.json(
dynamic url, {
String? method,
dynamic? body,
Map<String, String>? queryParameters,
Map<String, String>? headers,
}) {
var request = AWSRequest(
url,
method: method,
queryParameters: queryParameters,
headers: headers,
body: utf8.encode(jsonEncode(body)),
);
// override content-type header
request.contentType = 'application/json; charset=UTF-8';
return request;
}