-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow initiating client without authentication #75
Conversation
Do I understand correctly that initialization looks like this: const client = new Client({ host: '...' }) |
I got repro |
I think we need to change the logic in the public async sendRequest(request: AxiosRequestConfig, callback?: Callback): Promise<any> {
try {
request.headers = request.headers || {};
const authorization = request.headers.Authorization || getAuthentication(this.config, request);
if (!!authorization) {
request.headers.Authorization = authorization;
}
const response = await this.requestInstance.request(request);
... |
Yes, that's what's what causes the crash.
From what I can tell, that should work too, yeah. |
Will you make changes or should I do it? |
I've committed your suggestion to my branch 👍 |
Thank you for your contribution! |
Fixed in version 1.6.1 |
While switching over from jira-connector to jira.js, I ran into an issue with setting up the client; in particular, it would crash every time I tried to initiate a client without any authentication.
Since I'm working on a public JIRA instance and my use case does only require read but not write access, I'd expect this module to allow me to use the APIs that are also publicly available.
This used to work without issues in jira-connector.
I found that the issue simply was that the
getAuthentication
helper function returnedundefined
if no authentication was specified. Replacing thisundefined
with an empty string solved the issue.There was a test that explicitly checked for this
undefined
(which I changed in this PR), so I'm not sure if this was intentional and this issue is deeper in the core of axios?