fix: add trailing / to endpoint

Closes #2363
This commit is contained in:
Rhys Arkins 2018-08-20 12:53:57 +02:00
parent 93d02e5e75
commit d1ee797e54
3 changed files with 5 additions and 4 deletions

View file

@ -28,6 +28,7 @@ function update(params) {
`Failed to configure platform '${platform}': no endpoint defined` `Failed to configure platform '${platform}': no endpoint defined`
); );
} }
config.endpoint = endpoint.replace(/[^/]$/, '$&/');
let { host } = config; let { host } = config;
// extract host from endpoint // extract host from endpoint
host = host || (endpoint && URL.parse(endpoint).host); host = host || (endpoint && URL.parse(endpoint).host);

View file

@ -25,12 +25,12 @@ WebApi {
"userAgent": "vsts-node-api", "userAgent": "vsts-node-api",
}, },
}, },
"serverUrl": "myEndpoint", "serverUrl": "myEndpoint/",
"vsoClient": VsoClient { "vsoClient": VsoClient {
"_initializationPromise": Promise {}, "_initializationPromise": Promise {},
"_locationsByAreaPromises": Object {}, "_locationsByAreaPromises": Object {},
"basePath": "myEndpoint", "basePath": "myEndpoint/",
"baseUrl": "myEndpoint", "baseUrl": "myEndpoint/",
"restClient": RestClient { "restClient": RestClient {
"client": HttpClient { "client": HttpClient {
"_certConfig": undefined, "_certConfig": undefined,

View file

@ -2,7 +2,7 @@
exports[`util/endpoints find() allows overrides 1`] = ` exports[`util/endpoints find() allows overrides 1`] = `
Object { Object {
"endpoint": "endpoint", "endpoint": "endpoint/",
"name": "GitHub", "name": "GitHub",
"other": "data", "other": "data",
"platform": "github", "platform": "github",