Closed kleungkw closed 4 years ago
I'll look into this asap.
Hi @arnemolland any update?
Map bodyData = {
// This is where you define the body of the request,
"data": "abc"
};
// A larger request
final largeRequest = client.request(
path,
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: json.encode(bodyData)
);
// POST request
post(
largeRequest.url,
headers: largeRequest.headers,
body: largeRequest.body,
).then((res)=>{
this.setState(() {
_result = "status code: " + res.statusCode.toString() + " ; body: " + res.body.toString() + "\n\n\n";
_result += "headers:" + largeRequest.headers.toString();
})
});
same issue here, but if i don't attach body inside client.request every think work fine.
Hi @arnemolland any update?
Map bodyData = { // This is where you define the body of the request, "data": "abc" }; // A larger request final largeRequest = client.request( path, method: 'POST', headers: {'Content-Type': 'application/json'}, body: json.encode(bodyData) ); // POST request post( largeRequest.url, headers: largeRequest.headers, body: largeRequest.body, ).then((res)=>{ this.setState(() { _result = "status code: " + res.statusCode.toString() + " ; body: " + res.body.toString() + "\n\n\n"; _result += "headers:" + largeRequest.headers.toString(); }) });
same issue here, but if i don't attach body inside client.request every think work fine.
thank you very much @arnemolland
i solved this issue with mark header Content-Length on client.dart line 117 from this:
/// Set the `body`, if any
if (body == null || method == 'GET') {
body = '';
} else {
headers['Content-Length'] = utf8.encode(body).length.toString();
}
to this:
/// Set the `body`, if any
if (body == null || method == 'GET') {
body = '';
} else {
// headers['Content-Length'] = utf8.encode(body).length.toString();
}
Thanks, @fauzy6493
I’ll do some testing and remove this if it’s not breaking anything else.
I'm trying to use the package to make a call to SageMaker but I'm getting a signature does not match error.
Here's the relevant code snippet:
and the returned error:
I've double checked my key id and access key are correct from testing using Postman and on aws-cli.