Skip to content

Timberjack overwrites custom header fields and user agent #8

Description

@leogiertz

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions