{"action":"created","issue":{"url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest/issues/66","repository_url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest","labels_url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest/issues/66/comments","events_url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest/issues/66/events","html_url":"https://github.com/troyanskiy/ng2-resource-rest/issues/66","id":195110257,"number":66,"title":"Not taking previously set headers into account","user":{"login":"dbettini","id":16350909,"avatar_url":"https://avatars.githubusercontent.com/u/16350909?v=3","gravatar_id":"","url":"https://api.github.com/users/dbettini","html_url":"https://github.com/dbettini","followers_url":"https://api.github.com/users/dbettini/followers","following_url":"https://api.github.com/users/dbettini/following{/other_user}","gists_url":"https://api.github.com/users/dbettini/gists{/gist_id}","starred_url":"https://api.github.com/users/dbettini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbettini/subscriptions","organizations_url":"https://api.github.com/users/dbettini/orgs","repos_url":"https://api.github.com/users/dbettini/repos","events_url":"https://api.github.com/users/dbettini/events{/privacy}","received_events_url":"https://api.github.com/users/dbettini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-12T22:54:55Z","updated_at":"2016-12-14T10:18:18Z","closed_at":null,"body":"The library doesn't take previously set headers into account (maybe RequestOptions in general). In my app, I have overloaded [BaseRequestOptions](https://angular.io/docs/ts/latest/api/http/index/BaseRequestOptions-class.html), which means that each instance of RequestOptions instantiated through the app will use that as base. Resource just ignores it and gets empty headers instead.\r\nAlso, I have injected another CustomHttp in place of Http:\r\n```\r\n{\r\n    provide: Http,\r\n    useFactory: (backend, reqOpts, storage) => new CustomHttp(backend, reqOpts, storage),\r\n    deps: [XHRBackend, RequestOptions, StorageService]\r\n}\r\n```\r\nwhich also sets some specific headers. These headers are also ignored, even though the injected instance is indeed CustomHttp (checked it).\r\n\r\nP.S. The idea with CustomHttp is to use it in separate places instead of providing it in place of Http, does this library support choosing a different implementation of Http at the moment?"},"comment":{"url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest/issues/comments/266996927","html_url":"https://github.com/troyanskiy/ng2-resource-rest/issues/66#issuecomment-266996927","issue_url":"https://api.github.com/repos/troyanskiy/ng2-resource-rest/issues/66","id":266996927,"user":{"login":"troyanskiy","id":1538862,"avatar_url":"https://avatars.githubusercontent.com/u/1538862?v=3","gravatar_id":"","url":"https://api.github.com/users/troyanskiy","html_url":"https://github.com/troyanskiy","followers_url":"https://api.github.com/users/troyanskiy/followers","following_url":"https://api.github.com/users/troyanskiy/following{/other_user}","gists_url":"https://api.github.com/users/troyanskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/troyanskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troyanskiy/subscriptions","organizations_url":"https://api.github.com/users/troyanskiy/orgs","repos_url":"https://api.github.com/users/troyanskiy/repos","events_url":"https://api.github.com/users/troyanskiy/events{/privacy}","received_events_url":"https://api.github.com/users/troyanskiy/received_events","type":"User","site_admin":false},"created_at":"2016-12-14T10:18:18Z","updated_at":"2016-12-14T10:18:18Z","body":"Hi!\r\nFor the headers you can specify by setting setHeaders or simply create BaseResource class and override getHeaders method, [please check here ](https://github.com/troyanskiy/ng2-resource-rest/issues/57).\r\n\r\nTo use custom Http please try to inject it into the resource constructor and add the resource to your providers list manually (add parameter `add2Provides` to disable automatic adding to providers).\r\n\r\n```ts\r\n@ResourceParams({\r\n    url:BASE_API+\"/users\",\r\n    add2Provides: false\r\n})\r\nexport class UserResource extends Resource {\r\n\r\n    constructor(http: CustomHttp, injector: Injector) {\r\n      super(http, injector);\r\n    }\r\n    @ResourceAction({\r\n        isArray: false\r\n    })\r\n    query: ResourceMethod<IUserQueryInput, IUserShort[]>;\r\n}\r\n```"}}
{"actor":{"display_login":"troyanskiy"}}