[JENKINS-37838] Calls to backend MUST end with / (#454)
* [JENKINS-37838] Calls to backend MUST end with / * Append / to all urls in function
This commit is contained in:
parent
898c368656
commit
88cbacd967
|
@ -161,6 +161,20 @@ export function paginateUrl(url) {
|
|||
return (start, limit) => `${url}${sep}start=${start}&limit=${limit}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new string which ends with a slash, or the
|
||||
* original if it already does
|
||||
*/
|
||||
export function endSlash(str) {
|
||||
if (!str) {
|
||||
return str;
|
||||
}
|
||||
if (str.charAt(str.length - 1) !== '/') {
|
||||
return `${str}/`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Examines the provided object for:
|
||||
* organization, pipeline, branch, runId
|
||||
|
@ -183,21 +197,7 @@ export function getRestUrl({ organization, pipeline, branch, runId }) {
|
|||
if (runId) {
|
||||
url += `/runs/${encodeURIComponent(runId)}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new string which ends with a slash, or the
|
||||
* original if it already does
|
||||
*/
|
||||
export function endSlash(str) {
|
||||
if (!str) {
|
||||
return str;
|
||||
}
|
||||
if (str.charAt(str.length - 1) !== '/') {
|
||||
return `${str}/`;
|
||||
}
|
||||
return str;
|
||||
return endSlash(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue