-
Notifications
You must be signed in to change notification settings - Fork 763
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
Supporting github enterprise #322
Comments
Can you provide more input about what you'd like to see added to support your use case? Adding extra headers should be easy enough (we can add an options param to the GitHub constructor that will take any extra headers you need to send to your Enterprise instance), but I'm not familiar with configuring an XHR (wrapper) to accept unsigned certs. (though you could use this snippet: |
tl;drSomething like this would do the trick: option 1
option 2
DetailedSounds awesome! I thought so but I wasn't sure of the design principals (since opening up the headers could lead to weird situations). So for my needs, I'm adding:
The second one is helpful in case of I did check the Besides my custom needs, I do think the ability to have access to request object opens up all sort of possibilities. Whilst I don't have any other needs at the moment, I can see people needing access to other stuff (like specifying proxy or custom headers for tracking and so on). Users can shoot themselves in the foot but this could be one the advanced options which they may have to use at their own peril. Hope this makes sense... |
I think I got a bit overthrown by line149. So apart from passing the right request headers, the other thing that remains is parsing the response. I think I can live with |
It seems that even with However, I found this. Seems like a dead end to me. Even if you did add support for custom headers, you're ultimately limited by axios. I suppose asking to switch to request-promise would be too big of a change? Just thinking out loud... Anyway, I'll step aside now and let you come up with the best solution. Thanks for listening. |
By the way, if you consider switching to request-promise, here's what I had to do: // in _request (requestable.js)
const config = {
uri: url,
method: method,
headers: headers,
qs: queryParams, // params becomes qs
body: data, // data becomes body
...this.__options.requestOptions // this is my hack of passing additional options to 'request'
};
// instead of response.config.xxx, you access err.options.xxx
function callbackErrorOrThrow(cb, path) {
return function handler(err, response, body) {
logger.error(`error making request ${err.options.method} ${err.options.uri} ${response ? JSON.stringify(response):''}`);
let error = buildError(path, response || {}, err || body);
if (cb) {
cb(error);
} else {
throw error;
}
};
} And I've tested Repository functions and they seem fine. I can send a PR if you wish. |
@mrchief I'm don't think switching to
Is this a standard HTTP feature, a node feature, something custom to |
Passing ca is part of Node's I'm not sure if there is an equivalent or de-facto standard for browsers. I totally forgot about the fact that you support browsers as well. :) Yeah, #219 and headers would give me what I need. |
Based on my reading of that doc page, I don't think you need to pass "ca" as a header, instead If you're OK with trusting this CA globally throughout your program, you could do the following. (see axios/axios#284)
|
Of all the github api libs, I find this one to be the most well written. I've been using it for working with gihub enterprise and it works fine for most gets.
However, it fails on POST/PUT where:
Above 2 can be solved if there was a way to pass on additional headers for the request. Currently I'm using request-promise and passing the CA chain as well as custom headers when POST/PUT are needed but this is sub optimal solution.
I'm using this in a Node (v4.4.3 and above) app.
The text was updated successfully, but these errors were encountered: