From 9107e551f1a617d5c3d0c3dfef44c91422a1dd07 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Fri, 28 Apr 2017 19:09:11 +0300 Subject: close #5726 Turned out that the old code was wrong. I'm not sure why it used to work. `response.body` properly resolves to an async proc defined in the httpclient module with the following signature: proc body*(response: AsyncResponse): Future[string] {.async.} Perhaps the old code was somehow matching the body field of the `AsyncResponse` object, which is marked as private. --- web/bountysource.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/bountysource.nim b/web/bountysource.nim index 1d47cea56..8d4f36bf0 100644 --- a/web/bountysource.nim +++ b/web/bountysource.nim @@ -29,17 +29,19 @@ proc newBountySource(team, token: string): BountySource = result.client.headers["Referer"] = "https://salt.bountysource.com/teams/nim/admin/supporters" result.client.headers["Origin"] = "https://salt.bountysource.com/" +import typetraits + proc getSupporters(self: BountySource): Future[JsonNode] {.async.} = let response = await self.client.get(apiUrl & "/supporters?order=monthly&per_page=200&team_slug=" & self.team) doAssert response.status.startsWith($Http200) - return parseJson(response.body) + return parseJson(await response.body) proc getGithubUser(username: string): Future[JsonNode] {.async.} = let client = newAsyncHttpClient() let response = await client.get(githubApiUrl & "/users/" & username) if response.status.startsWith($Http200): - return parseJson(response.body) + return parseJson(await response.body) else: echo("Could not get Github user: ", username, ". ", response.status) return nil -- cgit 1.4.1-2-gfad0 ight' method='get' action='/ahoang/chawan/log/src/utils/map.nim'>
path: root/src/utils/map.nim
blob: 4966fcb6e3e715b90e3700de8b0819114641a5e4 (plain) (tree)
1
2
3
4
5
6
7
8
9