cookiesMiddleware function
Middleware
cookiesMiddleware()
Returns the cookie middleware.
Implementation
Middleware cookiesMiddleware() {
return (Handler innerHandler) {
return (Request request) async {
request = _addCookiesToRequest(request);
final response = await innerHandler(request);
final context = request.context;
final cookies = context[_cookiesKey] as List<Cookie>;
return response.change(headers: {
'Set-Cookie': cookies.map((e) => '$e').toList(),
});
};
};
}