Reputation: 401
I’m trying to POST using package:http/http.dart, but I’m getting a ClientException with no message:
Uriurl = Uri.https(baseURL, path);
return http.post(url, body: request.params, headers: _headers)
How do I find out what the error is? The path var contains a relative, valid path. If I replace it with some random string, I'm not getting the ClientException anymore.
Upvotes: 0
Views: 893
Reputation: 343
I didn't find any way to receive the error description, but in my case (sometimes error "HttpException: Connection closed before full header was received" instead of blank error) the call was to an https address using Microsoft Internet Information Services as backend, in the SSL settings of the website in IIS i had mistakenly set "Client certificates: Accept" instead of "Client certificates: Ignore", setting "Ignore" solved the problem.
Upvotes: 1
Reputation: 17746
Just wrap it in a try-catch
clause and you should see what error is being thrown.
try {
Uri url = Uri.https(baseURL, path);
return http.post(url, body: request.params, headers: _headers)
} catch (ex) {
print(ex); // This is your error
}
Upvotes: 0