0

I have http.post request and i need to get data from header, key of this header value is Set-cookie this is function that i need to use for it

  Future<String> getssid() async {
    String ssidSeverLink = "some server link that need to be private";
    http.Response response;
    response = await http.post(Uri.parse(ssidSeverLink), body: "some body for request that probably need to be private");
    // this is what i tried to do, it don't work
    print(jsonDecode(response.headers.toString())["Set-Cookie"]);
    return some local variable maybe
  }
GDTyka
  • 472
  • 3
  • 16

1 Answers1

2

try following

Map<String, List<String>> setCookie = response.headers.map['set-cookie'];

this will give you a map, you can then iterate and pick the relevant data

iamdipanshus
  • 492
  • 3
  • 12