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

let consumers specify custom HTTP headers #6

Merged
merged 1 commit into from Dec 27, 2015
Merged

let consumers specify custom HTTP headers #6

merged 1 commit into from Dec 27, 2015

Conversation

mykmelez
Copy link
Contributor

In some cases it's helpful for API consumers to be able to set custom HTTP headers, particularly User-Agent, because the Travis API servers will whitelist certain values of that header (in response to problems like https://www.traviscistatus.com/incidents/bntk781kb8y8). This branch adds a headers option that accepts custom headers to set on requests.

I'm not sure how to unit test this, as I don't see other unit tests that are checking the values of request headers. But I've confirmed that it enables me to fix a problem with accessing a Travis API endpoint by specifying a whitelisted User-Agent header.

@mykmelez
Copy link
Contributor Author

Incidentally, I based this on the similar feature in https://www.npmjs.com/package/github. That module also lets you set custom headers per-request, which I can add if you'd like, although it isn't necessary for my particular use case.

@erichirlemann
Copy link

+1

@rkh
Copy link

rkh commented Dec 16, 2015

Also, a default user-agent value would allow us to whitelist the library.

@iamstarkov
Copy link

@pwmckenna can you merge this pull-request? this issue hurts me everyday

@pwmckenna
Copy link
Owner

sorry for the delay. this looks great. @rkh any preference on user-agent string to use?

pwmckenna pushed a commit that referenced this pull request Dec 27, 2015
let consumers specify custom HTTP headers
@pwmckenna pwmckenna merged commit cb8a7e0 into pwmckenna:master Dec 27, 2015
@pwmckenna
Copy link
Owner

just published to npm as version 2.1.0. thanks again everyone! also, my delay time on this things has gone way up, so if anyone is interested in helping maintain I'd appreciate the help. Happy to give walkthroughs etc if need be.

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

Successfully merging this pull request may close these issues.

None yet

5 participants