about summary refs log tree commit diff stats
path: root/src/types/url.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/types/url.nim')
-rw-r--r--src/types/url.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/types/url.nim b/src/types/url.nim
index 8d274b57..fc9e20e8 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -947,6 +947,14 @@ proc set*(params: URLSearchParams, name: string, value: string) {.jsfunc.} =
         first = false
         params.list[i][1] = value
 
+proc newURL*(url: URL): URL =
+  new(result)
+  result[] = url[]
+  if url.searchParams != nil: #TODO ideally this should never be false
+    result.searchParams = URLSearchParams()
+    result.searchParams[] = url.searchParams[]
+    result.searchParams.url = some(result)
+
 #TODO add Option wrapper
 proc newURL*(s: string, base: Option[string] = none(string)): URL {.jserr, jsctor.} =
   if base.issome: