I am facing an issue with http post request for register in my flutter app.
body: {"username": _username, "email": _email, "password": _password});
final responseData = json.decode(response.body);
when this post request is executed, i am getting error as,
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FormatException: Unexpected character (at character 1)E/flutter (25820): <!DOCTYPE html>
E/flutter (25820): ^
E/flutter (25820):
I deployed my app to Heroku and tried with the new url, i am getting the same error with heroku url also.
I tried the above post command on Postman also, the response is provided below
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<title>Application Error</title>
<style media="screen">
html,body,iframe {
margin: 0;
padding: 0;
}
html,body {
height: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
border: 0;
}
</style>
</head>
<body>
</body>
</html>
please find the images below for postman settings page, and result obtained.
Only register request is having the issue, login post request is working fine.
body: {"identifier": _email, "password": _password});
print('LOGIN body: [${response.body}]');
final responseData = json.decode(response.body);
The above post request is working fine from app and through Postman. Kindly help, i dont have any clue why register is not working.