diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-07-20 17:46:49 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-07-20 17:46:49 +0530 |
commit | dd2efc3d78f2dfda44f8182f9638723dcb839781 (patch) | |
tree | 9cfbd31607f044fb80da80d8f740ae5eaa21a2f4 /src/operations/withdraw.ts | |
parent | 5a8931d90320ebc8454969ea133c48b6998ad60a (diff) | |
download | wallet-core-dd2efc3d78f2dfda44f8182f9638723dcb839781.tar.gz wallet-core-dd2efc3d78f2dfda44f8182f9638723dcb839781.tar.bz2 wallet-core-dd2efc3d78f2dfda44f8182f9638723dcb839781.zip |
nicer HTTP helper in preparation for better error handling
Diffstat (limited to 'src/operations/withdraw.ts')
-rw-r--r-- | src/operations/withdraw.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts index 19b470e83..98969d213 100644 --- a/src/operations/withdraw.ts +++ b/src/operations/withdraw.ts @@ -46,7 +46,7 @@ import { updateExchangeFromUrl, getExchangeTrust } from "./exchanges"; import { WALLET_EXCHANGE_PROTOCOL_VERSION } from "./versions"; import * as LibtoolVersion from "../util/libtoolVersion"; -import { guardOperationException, scrutinizeTalerJsonResponse } from "./errors"; +import { guardOperationException } from "./errors"; import { NotificationType } from "../types/notifications"; import { getTimestampNow, @@ -54,6 +54,7 @@ import { timestampCmp, timestampSubtractDuraction, } from "../util/time"; +import { httpPostTalerJson } from "../util/http"; const logger = new Logger("withdraw.ts"); @@ -308,8 +309,13 @@ async function processPlanchet( `reserves/${planchet.reservePub}/withdraw`, exchange.baseUrl, ).href; - const resp = await ws.http.postJson(reqUrl, wd); - const r = await scrutinizeTalerJsonResponse(resp, codecForWithdrawResponse()); + + const r = await httpPostTalerJson({ + url: reqUrl, + body: wd, + codec: codecForWithdrawResponse(), + http: ws.http, + }); logger.trace(`got response for /withdraw`); |