In this line;
|
httpRequest.headers.forEach((header, value) { |
Shouldn't it be:
response.request.headers.forEach((header, value) {
As httpRequest.headers is empty, having only just been initialised, and response.request is the request as passed into the call.