Closed tandy-1000 closed 2 years ago
Do not consider XMLHttpRequest and Firefox an actual Blocker, it is not our fault that recent years Firefox kinda lags behind Chromium in a few new features, it is Ok to make it just work in Chromium for now, it is not a Blocker to Merge. 🙂
I think Mozilla wasted too much resources in Rust and it shows...
Do not consider XMLHttpRequest and Firefox an actual Blocker, it is not our fault that recent years Firefox kinda lags behind Chromium in a few new features, it is Ok to make it just work in Chromium for now, it is not a Blocker to Merge. slightly_smiling_face
I think Mozilla wasted too much resources in Rust and it shows...
I couldn't get it to work in chromium either unfortunately :(
I used this one and it works: https://github.com/juancarlospaco/nodejs/blob/main/src/nodejs/jsxmlhttprequest.nim
Otherwise post the full repro code that you are using.
I used this one and it works: https://github.com/juancarlospaco/nodejs/blob/main/src/nodejs/jsxmlhttprequest.nim
Otherwise post the full repro code that you are using.
Hmm, interesting, I'll try that
Ok my mistake, fusion/xmlhttprequest wasn't the issue, it was nodejs/jssynchttpclient .. I tested the latest commit and the before this PR, both don't seem to work
Make an issue with full repro code and error traceback from the console ?.
Make an issue with full repro code and error traceback from the console ?.
Fixed, all green.
Do you think it is doable ?, it is too complicated ?.
If it is not doable, maybe Harpoon can be adapted to run in JS, it has unified interface compatible with hhtpclient. 🤔
Do you think it is doable ?, it is too complicated ?.
If it is not doable, maybe Harpoon can be adapted to run in JS, it has unified interface compatible with hhtpclient. thinking
It is definitely doable, I haven't have time to take a look in the past few weeks.
Last time I worked on it I've been trying to figure out a good architecture - I can't really look at the Nim stdlib httpclient, because it sucks.
I don't think setting headers is working on XMLHTTPRequest
in my tests on firefox / chromium they show up as undefined..
Yeah, welcome to the land of buggy APIs of JavaScript. 🙂
I also realised my generalisation of using fetchOptions for all requests (even those that don't require a body) does not work :(
Maybe its worth making body
in FetchOptions
an Option
?
I think that if it is not very stable, then jsasynchttpclient.nim
and jshttpclient.nim
need to be kept,
also maybe some people used those modules already, and deleting the files may break their code,
so restore jsasynchttpclient.nim
and jshttpclient.nim
at least for now please...
Sure, I'll restore those.
jsxmlhttprequest.nim
func setRequestHeader*(this: XMLHttpRequest; keyValuePairs: openArray[tuple[key, val: cstring]]) {.importjs:
"(() => { const rqst = #; #.forEach((item) => rqst.$1(item[0], item[1])) })()".}
## Same as `setRequestHeader` but takes `openArray[tuple[key, val: cstring]]`.
I think this is the place with the bug
I think this is the place with the bug
Which bug ?, it was working last time I used it, can you fix it?.
I think this is the place with the bug
Which bug ?, it was working last time I used it, can you fix it?.
When headers get added using that they show up like undefined: undefined, undefined undefined
.
I'll try.
The last commit fixed things, so I will attempt using this new experimental/jshttpclient in some api bindings when we merge soon :)
When you consider is ready let me know, well review and merge...
When you consider is ready let me know, well review and merge...
I think it is ready now that you can pass headers through, any other features you think might be useful?
ReSync with main branch plz, it wont let me merge because is not in sync...
git pull https://github.com/juancarlospaco/nodejs.git main
git commit -am "ReSync"
git push origin jshttpclient
... or something like that.
I have no idea how to fix this git mess..
Building on from work in https://github.com/nim-lang/Nim/pull/17373/.
TODO: