-
-
Save bdshadow/ad64d6f3660422e8ff06572f4bf6e7fd to your computer and use it in GitHub Desktop.
CERTIFICATE_VERIFY_FAILED: Hostname mismatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'dart:io'; | |
void main() { | |
var url = "https://192.168.39.219:8443/version"; | |
SecurityContext context = SecurityContext(); | |
context.setTrustedCertificates("/home/dbocharo/.minikube/ca.crt"); | |
context.usePrivateKey("/home/dbocharo/.minikube/ca.key"); | |
HttpClient client = new HttpClient(context: context); | |
client.getUrl(Uri.parse(url)) | |
.then((HttpClientRequest request) => request.close()) | |
.then((HttpClientResponse response) { | |
response.transform(utf8.decoder).listen((contents) { | |
print(contents); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment