Skip to content

Commit d417a55

Browse files
committed
adds path object
1 parent 26e9361 commit d417a55

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

jb-postman.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ iff.eachLine {
3232
if (rawUrl.contains("://")) {
3333
def extUrl = rawUrl.split("://")
3434
url.put("protocol", extUrl[0])
35-
url.put("host", extUrl[1].split("/")?[0]?.split("\\."))
35+
def cleanUrl = extUrl[1].split("\\?")[0] // remove query part
36+
if (cleanUrl.contains("/")){ // if has path part
37+
url.put("host", cleanUrl.split("/")?[0]?.split("\\."))
38+
url.put("path", cleanUrl.split("/")?[1..-1])
39+
} else {
40+
url.put("host", cleanUrl.split("\\."))
41+
}
3642
} else {
3743
url.put("host",rawUrl.split("/")?[0]?.split("\\."))
3844

0 commit comments

Comments
 (0)