mirror of https://github.com/bastienwirtz/homer
Merge pull request #393 from jamesmacwhite/ping-endpoint-urls
Check if path has data before adding a trailing slash (/)pull/399/head
commit
db2a2af3a4
|
@ -31,7 +31,13 @@ export default {
|
|||
path = path.slice(1);
|
||||
}
|
||||
|
||||
return fetch(`${this.endpoint}/${path}`, options).then((response) => {
|
||||
let url = this.endpoint;
|
||||
|
||||
if (path) {
|
||||
url = `${this.endpoint}/${path}`;
|
||||
}
|
||||
|
||||
return fetch(url, options).then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Not 2xx response");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue