-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add jshttpclient #17373
Add jshttpclient #17373
Conversation
Co-authored-by: Timothee Cour <[email protected]>
lib/std/js/jsasynchttpclient.nim
Outdated
|
||
|
||
runnableExamples("-d:nimExperimentalJsfetch -r:off"): | ||
import std/asyncjs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this example doesn't work in a browser
I have a WIP PR to make nim doc -b:js -r --browser main
which will simplify testing but until it's merged, these things must be tested manually
You can always use backticks around "method" so IMHO it should remain "method" and not some bastardized spelling of it. |
It should work now if you fetch the latest commits? Unrelated CI failure should be fixed. see #17752 |
@xflywind Great!, thanks, will do. If you want to take a look at the code would be nice too. 🙂 |
Ping @timotheecour |
Does a user have to explicitly use the JS version of the HTTPClient, or is it done automatically depending on the target platform? |
For native targets you import |
Is there any reason the implementation can't or shouldn't automatically adapt to the environment being targeted? Using completely different types makes it difficult to write generic functions that can be used across library implementations. |
Ye, the sandbox of the browser. |
self.send(body = body.cstring) | ||
self.responseText | ||
|
||
proc getContent*(self: JsHttpClient; url: Uri | string): cstring = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this API is completely new, should we only allow Uri
and not string
?.
Please contribute to https://github.com/nim-lang/standardjs instead. (Yes, it still needs CI support, will be added soon'ish.) |
httpclient
for JavaScript targets. This was requested on the original PR/RFC.