I am trying to make post call as the code bellow shows.
Map<String, String> header = {"Content-Type": "application/json"};
Map<String, String> body = {
"client_id": "xxxx",
"client_secret": "XXXX",
"password": "password",
"username": "username",
};
Future<Post> callForFirstToken() async {
final response = await http.post(url, headers: header, body: body);
return response.statusCode == 200
? Post.fromJson(json.decode(response.body))
: throw Exception('Failed to load ...');}
But, I have got this error:
Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:60556/sK_cPlYMcGQ=/ws