Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timberjack overwrites custom header fields and user agent #8

Open
leogiertz opened this issue May 2, 2016 · 2 comments
Open

Timberjack overwrites custom header fields and user agent #8

leogiertz opened this issue May 2, 2016 · 2 comments

Comments

@leogiertz
Copy link

We set custom header fields on the default session configuration which Timberjack removes

To reproduce create a manager in the following way:

class HTTPManager: Manager {
    static let sharedManager: HTTPManager = {
        let configuration = Timberjack.defaultSessionConfiguration()
        let version = NSBundle.mainBundle().infoDictionary!["CFBundleVersion"] as! String
        let release = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"] as! String

        let device = UIDevice.currentDevice()

        configuration.HTTPAdditionalHeaders = [
            "User-Agent": "AppName iOS \(release)/\(version); \(device.systemName) \(device.systemVersion))",
            "X-Device-Id": "Some generated ID"
        ]

        let manager = HTTPManager(configuration: configuration)
        return manager
    }()
}

The received request looks like this:

POST /v1/event HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Connection: keep-alive
Accept: */*
User-Agent: AppName/54 CFNetwork/711.4.6 Darwin/15.4.0
Content-Length: 81
Accept-Language: en-us
Accept-Encoding: gzip, deflate

The expected header should look like this:

POST /v1/event HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Connection: keep-alive
X-Device-Id: Some generated ID
Accept: */*
User-Agent: AppName iOS 0.6.0/54; iPhone OS 8.4)
Content-Length: 81
Accept-Language: en-us
Accept-Encoding: gzip, deflate
@leogiertz
Copy link
Author

We're using Timberjack with the lastest Alamofire (3.3.1)

@perezpaya
Copy link

+1 After adding a custom header, with Timberjack it gets removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants