Skip to content

Commit

Permalink
fix: fix path on requestOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
codeswriter committed Oct 14, 2022
1 parent 902f975 commit 8b8833c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/authorization-server-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getAuthUrlFromOCP = async (url, insecureSkipTlsVerify = true) => {
}
});
const requestOptions = {
path: '.well-known/oauth-authorization-server',
path: '/.well-known/oauth-authorization-server',
method: 'GET'
};
client.request(requestOptions).then(async (responseData) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/basic-auth-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function getUserFromAuthToken (settings) {
}
});
const requestOptions = {
path: 'apis/user.openshift.io/v1/users/~',
path: '/apis/user.openshift.io/v1/users/~',
method: 'GET',
headers: { Authorization: `Bearer ${settings.token}` }
};
Expand Down
4 changes: 2 additions & 2 deletions test/authorization-server-request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const test = require('tape');
const proxyquire = require('proxyquire');
const BASE_URL = 'http://some.cluster.com:6443/';
const BASE_URL = 'http://some.cluster.com:6443';

function create (MockClient) {
return proxyquire('../lib/authorization-server-request', {
Expand Down Expand Up @@ -58,7 +58,7 @@ test('authorization server request URL join safety', (t) => {
}

request (options) {
t.equal(this.url + options.path, `${BASE_URL}.well-known/oauth-authorization-server`);
t.equal(this.url + options.path, `${BASE_URL}/.well-known/oauth-authorization-server`);
return new Promise((resolve, reject) => {
resolve({
statusCode: 200,
Expand Down
4 changes: 2 additions & 2 deletions test/basic-auth-request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const test = require('tape');
const proxyquire = require('proxyquire');
const BASE_URL = 'http://some.cluster.com:6443/';
const BASE_URL = 'http://some.cluster.com:6443';

test('basic auth request', (t) => {
class MockClient {
Expand Down Expand Up @@ -278,7 +278,7 @@ test('get user from token URL join safety', (t) => {
}

request (options) {
t.equal(this.url + options.path, `${BASE_URL}apis/user.openshift.io/v1/users/~`);
t.equal(this.url + options.path, `${BASE_URL}/apis/user.openshift.io/v1/users/~`);
return new Promise((resolve, reject) => {
resolve({
statusCode: 200,
Expand Down

0 comments on commit 8b8833c

Please sign in to comment.