Reputation: 125
This is the function containing the request :
Future<String> getRequest(String serviceName, Map<String, String> a) async {
var responseBody = '{"data": "", "status": "NOK"}';
try {
http.Response response =
await http.get(_urlBase + '$_serverApi$serviceName', headings: a);
if (response.statusCode == 200) {
responseBody = response.body;
}
} catch (e) {
// An error was received
throw new Exception("GET ERROR");
}
return responseBody;
}
and this is where i call it :
void _confirm() async {
if (_formKey.currentState.saveAndValidate()) {
print(_formKey.currentState.value);
Map<String, String> c =
Map<String, String>.from(_formKey.currentState.value);
// just below
var a = await auth.getRequest('se_connecter', c);
print(a);
} else {
print(_formKey.currentState.value);
print("validation failed");
}
}
everytime i try it, the code in the try bloc fails, and it throws the exception (ClientException after i removed try and catch bloc)
This the exception stacktrace :
I/flutter (10979): #0 IOClient.send
package:http/src/io_client.dart:65
I/flutter (10979): <asynchronous suspension>
I/flutter (10979): #1 BaseClient._sendUnstreamed
package:http/src/base_client.dart:176
I/flutter (10979): #2 BaseClient.get
package:http/src/base_client.dart:35
I/flutter (10979): #3 get.<anonymous closure>
package:http/http.dart:46
I/flutter (10979): #4 _withClient
package:http/http.dart:166
I/flutter (10979): #5 get
package:http/http.dart:46
I/flutter (10979): #6 getRequest
package:event_app/auth.dart:125
I/flutter (10979): #7 ConnectPageState._confirm
package:event_app/pages/connect_page.dart:28
I/flutter (10979): #8 _InkResponseState._handleTap
package:flutter/…/material/ink_well.dart:706
I/flutter (10979): #9 _InkResponseState.build.<anonymous closure>
package:flutter/…/material/ink_well.dart:789
I/flutter (10979): #10 GestureRecognizer.invokeCallback
package:flutter/…/gestures/recognizer.dart:182
I/flutter (10979): #11 TapGestureRecognizer.handleTapUp
package:flutter/…/gestures/tap.dart:486
I/flutter (10979): #12 BaseTapGestureRecognizer._checkUp
package:flutter/…/gestures/tap.dart:264
I/flutter (10979): #13 BaseTapGestureRecognizer.
Upvotes: 0
Views: 2018
Reputation: 343
In my case (sometimes instead of blank appeared the error "HttpException: Connection closed before full header was received") 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: 2
Reputation: 125
Solved, the problem was the ssl encryption, so i removed it from my backend.
Upvotes: 1