Skip to content

Commit 11258f4

Browse files
committed
[RequestMaker] Add wild path support.
1 parent c715248 commit 11258f4

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/request-maker/core.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,28 @@ class RMCore {
2727
path: string,
2828
config: RMConfig
2929
) {
30+
let domain = LPConfiguration.server;
31+
3032
if (path.length === 0) {
3133
path = "/";
3234
}
33-
if (path.charAt(0) !== '/') {
34-
path = '/' + path;
35+
36+
if (path.charAt(0) !== "/") {
37+
if (path.indexOf("http") === 0) {
38+
if (path.indexOf("/", 8) === -1) {
39+
domain = path;
40+
path = "";
41+
} else {
42+
domain = path.substring(0, path.indexOf("/", 8));
43+
path = path.substring(path.indexOf("/", 8));
44+
}
45+
} else {
46+
path = "/" + path;
47+
}
3548
}
3649

3750
// Generate the url based on the path and the config server url.
38-
this.url = LPConfiguration.server + path;
51+
this.url = domain + path;
3952

4053
this.method = method;
4154
this.header = {

0 commit comments

Comments
 (0)