diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-08 08:03:16 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-08 08:03:16 +0200 |
commit | 00d7836d8a3d0101bd282e3acce58d65ed0220fe (patch) | |
tree | 70ff6f736277ab277bf527b4e3b79771bb7e3935 /src/io | |
parent | 23339918fa58f570a2b12bc7c7e78d4d8681b9a2 (diff) | |
download | chawan-00d7836d8a3d0101bd282e3acce58d65ed0220fe.tar.gz |
Remove JSObject again, add File API constructor
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/request.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/io/request.nim b/src/io/request.nim index 08947bd5..ed38ad47 100644 --- a/src/io/request.nim +++ b/src/io/request.nim @@ -186,10 +186,13 @@ proc fill(headers: Headers, ctx: JSContext, val: JSValue) = else: headers.table[k] = @[v] -func newHeaders*(obj = none(JSObject)): Headers {.jsctor.} = +func newHeaders*(): Headers = + new(result) + +func newHeaders*(ctx: JSContext, obj = none(JSValue)): Headers {.jsctor.} = new(result) if obj.isSome: - result.fill(obj.get.ctx, obj.get.val) + result.fill(ctx, obj.get) func newHeaders*(table: Table[string, string]): Headers = new(result) @@ -239,8 +242,7 @@ func createPotentialCORSRequest*(url: URL, destination: RequestDestination, cors return newRequest(url, destination = destination, mode = mode, credentialsMode = credentialsMode) #TODO resource as Request -#TODO also, I'm not sure what to do with init. For now I've re-introduced -# JSObject to make this work, but I really wish we had a better solution. +#TODO init as an actual dictionary func newRequest*(ctx: JSContext, resource: string, init = none(JSValue)): Request {.jserr, jsctor.} = let x = parseURL(resource) |