You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hey, im having a hard time to retrieve multiple 'set-cookies' from my API. as illustrated below, the Postman is receiving 2 'set-cookies' but the Requests can only retrieve 1. is there any workaround on this? thank you!
Future<LoginModel> login(String email, String password) async {
final uri = _baseUrl + "/login";
Map<String, String?> body = {
'email': email,
'password': password,
};
final response = await Requests.post(uri, body: body, persistCookies: true);
if (response.success) {
print("success");
//check for cookies
var cookie = await Requests.getStoredCookies(Requests.getHostname(uri));
print("cookie length: $cookie");
print("cookie user: ${cookie["user"]}");
print("cookie token_id: ${cookie["token_id"]}");
return LoginModel.fromJson(json.decode(response.content()));
} else {
print(response.statusCode);
response.throwForStatus();
throw Exception('Failed to login');
}
}
Future<UserModel> getUserDetail() async {
final uri = _baseUrl + "/user";
final response = await Requests.get(uri);
print(response);
if (response.success) {
print("success");
return UserModel.fromJson(json.decode(response.content()));
} else {
print(response.statusCode);
response.throwForStatus();
throw Exception('Failed to retrieve user info');
}
}
The text was updated successfully, but these errors were encountered:
I think I know why. The current parsing algorithm of the releases is broken as it does not fully extract the cookies. The issue was that http would concatenate all the SET-COOKIES headers with ,. #47 fixed that but I want to wait for #63 to create a new release.
Alternatively you can install the package via git like so:
hey, im having a hard time to retrieve multiple 'set-cookies' from my API. as illustrated below, the Postman is receiving 2 'set-cookies' but the Requests can only retrieve 1. is there any workaround on this? thank you!
The text was updated successfully, but these errors were encountered: