Reputation: 2411
I try to do this like this. But this give me the error : Unhandled Exception: HandshakeException: Handshake error in client (OS Error: E/flutter (31038): WRONG_VERSION_NUMBER(tls_record.cc:242)) Host name have good name. It's a server.
This is my code. How to do this?
var queryParameters = {
'abc': 'abc',
'bcd': 'bcd,
'cde' : 'cde'
};
var uri = Uri.https('www.xyz.pl:1234', '/admin/api/get', queryParameters);
var response1 = await http.get(uri);
Upvotes: 1
Views: 1233
Reputation: 3504
You can create Map<String, String> headers, body, encoding
for pass multiple reguest param. You can check it here.
Upvotes: 0
Reputation: 3043
Pseudo
var res = await http.get(
Uri.encodeFull('www.xyz.pl'),
headers : queryParameters);
hardcoded
var res = await http.get(
Uri.encodeFull('www.xyz.pl'),
headers : {
"abc": "abc",
"bcd": "bcd",
"cde": "cde"
});
final statusCode = res.statusCode;
Explanation how to make authenticated requests here - https://flutter.dev/docs/cookbook/networking/authenticated-requests
Upvotes: 2
Reputation: 272
var queryParameters = {
'abc': 'abc',
'bcd': 'bcd,
'cde' : 'cde'
};
var uri ='www.xyz.pl:1234/admin/api/get'; // your url
bool trustSelfSigned = true;
HttpClient httpClient = new HttpClient()
..badCertificateCallback =
((X509Certificate cert, String host, int port) => trustSelfSigned);
IOClient ioClient = new IOClient(httpClient);
await ioClient.get(Uri.parse(uri), body: queryParameters).then((response) {
if (response.statusCode == 200) {
print(response);
}
Try this code
Upvotes: 1