Closed tandy-1000 closed 2 years ago
Console reports JsHttpClient object is null.
JsHttpClient
Append to bottom of src/nodejs/jssynchttpclient.nim
src/nodejs/jssynchttpclient.nim
when isMainModule: from std/uri import parseUri, Uri let client = newJsHttpClient() let url = parseUri("https://google.com") let content = client.getContent(url)
src/nodejs/index.html
<script src="jssynchttpclient.js"></script>
Run nimhttpd and access http://localhost:1337/src/nodejs/index.html, check the browser console.
nimhttpd
Uncaught TypeError: self_436207679 is null xmlHttpRequestImpl_436207675 http://localhost:1337/src/nodejs/jssynchttpclient.js:782 getContent_436207670 http://localhost:1337/src/nodejs/jssynchttpclient.js:798 <anonymous> http://localhost:1337/src/nodejs/jssynchttpclient.js:929 jssynchttpclient.js:782:5 xmlHttpRequestImpl_436207675 http://localhost:1337/src/nodejs/jssynchttpclient.js:782 getContent_436207670 http://localhost:1337/src/nodejs/jssynchttpclient.js:798 <anonymous> http://localhost:1337/src/nodejs/jssynchttpclient.js:929
Console reports
JsHttpClient
object is null.Code
Append to bottom of
src/nodejs/jssynchttpclient.nim
src/nodejs/index.html
How to reproduce
Run
nimhttpd
and access http://localhost:1337/src/nodejs/index.html, check the browser console.Console log