                         if response.statusCode >= 400 && response.statusCode < 600 {
                             return GitHubError.decode(JSON)
                                 .mapError(Error.JSONDecodingError)
-                                .flatMap { .Failure(Error.APIError(response.statusCode, $0)) }
+                                .flatMap { error in
+                                    .Failure(Error.APIError(response.statusCode, Response(headerFields: headers), error))
+                                }
                         }
                         return Resource.decode(JSON).mapError(Error.JSONDecodingError)
                     }
                     .map { resource in
-                        return (Response(headerFields: response.allHeaderFields as! [String:String]), resource)
+                        return (Response(headerFields: headers), resource)
                     }
             }
     }

    case let (.JSONDecodingError(error1), .JSONDecodingError(error2)):
        return error1 == error2
        
    case let (.APIError(statusCode1, error1), .APIError(statusCode2, error2)):
        return statusCode1 == statusCode2 && error1 == error2
        
    case (.DoesNotExist, .DoesNotExist):
        return true

            .mapError(Error.NetworkError)
            .flatMap(.Concat) { data, response -> SignalProducer<(Response, Resource), Error> in
                let response = response as! NSHTTPURLResponse
                let headers = response.allHeaderFields as! [String:String]
                return SignalProducer
                    .attempt {
                        return NSJSONSerialization.deserializeJSON(data).mapError(Error.JSONDeserializationError)
