# I'm trying to run the example from the std/jsfetch docs # (https://nim-lang.org/docs/jsfetch.html) but when I run it I get an error saying # the "then" proc is undelcared even though i've imported jsfetch. # I think I recall reading something somewhere about a compile option that I have # to enable? # like "experimental..somthing"? But the docs say othing about that Error: attempting to call undeclared routine: 'then' stack trace: (most recent call last) import std/jsfetch import std/[asyncjs, jsconsole, jsformdata, jsheaders] from std/httpcore import HttpMethod from std/jsffi import JsObject from std/sugar import `=>` if not defined(nodejs): block: proc doFetch(): Future[Response] {.async.} = #fetch "https://httpbin.org/get".cstring fetch "https://catfact.ninja/fact".cstring proc example() {.async.} = let response: Response = await doFetch() assert response.ok assert response.status == 200.cint assert response.headers is Headers assert response.body is cstring discard example() block: proc example2 {.async.} = await fetch("https://catfact.ninja/fact".cstring) .then((response: Response) => response.json()) .then((json: JsObject) => console.log(json)) .catch((err: Error) => console.log("Request Failed", err)) discard example2()