                             // user-agent
                             request.addValue("\(serviceRequest.getUserAgent())", forHTTPHeaderField: "User-Agent")
                             
-                            // TODO HEADERS & SESSION
-                            if let h:Header =  headers[serviceRequest.getServiceToken()!.getEndpointName()!] {
+                            // HEADERS & SESSION
+                            
+                            var endpoint = serviceRequest.getServiceToken()!.getEndpointName()!
+                            
+                            if let h:Header =  headers[endpoint] {
                                 
-                                // There is a header, update the values
-                                h.userAgent = serviceRequest.getUserAgent()
+                                self.logger.log(ILoggingLogLevel.Debug, category: self.loggerTag, message: "Loading previous headers information stored")
                                 
-                                headers[serviceRequest.getServiceToken()!.getEndpointName()!] = h
+                                for c:ServiceSessionCookie in h.cookies {
+                                    self.logger.log(ILoggingLogLevel.Debug, category: self.loggerTag, message: "Setting cookie: \(c.getCookieName())=\(c.getCookieValue())")
+                                    request.addValue(c.getCookieValue(), forHTTPHeaderField: c.getCookieName()!)
+                                }
                                 
-                            } else {
-                                
-                                // There is no header, create one and set it
-                                var h:Header = Header()
-                                h.userAgent = serviceRequest.getUserAgent()
-                                
-                                headers[serviceRequest.getServiceToken()!.getEndpointName()!] = h
                             }
                             
                         } else {

                                            response.setContentType(IOParser.sharedInstance.getContentType(token))
                                            response.setStatusCode(sCode)
                                            
                                            // TODO: HEADERS & SESSION
                                            
                                            // Check for Not secured url
                                            /*if !url.containsString("https://") {
                                                self.logger.log(ILoggingLogLevel.Warn, category: self.loggerTag, message: "Not Secured URL (https): \(url)")
                                                callback.onWarning(response, warning: IServiceResultCallbackWarning.NotSecure)
                                            }*/
                                            
                                            switch sCode {
                                                
                                            case 200...299:
                                                //self.logger.log(ILoggingLogLevel.Error, category: self.loggerTag, message: "\(response.getContent()!)")
                                                
                                                callback.onResult(response)
                                                return
                                                
                                            case 300...399:

            
        } else {
            logger.log(ILoggingLogLevel.Debug, category: loggerTag, message: "There is no previous information for this endpoint: \(serviceToken.getEndpointName()!)")
            headers[serviceToken.getEndpointName()!] = Header()
        }*/
        return request
    }
    
