I am trying to send a post request from my flutter app to a signup endpoint of the next.js server. It is not working properly. It is giving me 308 status code or the permanent redirect or Redirecting... in the response even though there is not such thing done on the backend.`
Future<void> signup(String name, String email, String password) async {
setLoading(true);
try {
var headersList = {
'Accept': '*/*',
'Content-Type': 'application/json'
};
var url = Uri.parse('http://taskmasterapp.vercel.app/api/appsignup');
var body = {
"name": name,
"email": email,
"password": password
};
http.Response response = await http.post(url, headers: headersList, body: jsonEncode(body));
String data = response.body;
print(data);
} catch (e) {
print(e.toString());
}
}
this is the output -
I/flutter ( 9161): Redirecting...
I tried to fetch the redirecting url and then again make a post request on the redirecting url (FYI which is the same as the url im sending my first post request on). it works but i have to send 2 request for each task and i dont want that