@api-ts/superagent-wrapper
Advanced tools
Comparing version 1.0.0 to 1.1.1
@@ -70,2 +70,3 @@ "use strict"; | ||
}; | ||
const stringify = (value) => JSON.stringify(value, (_key, value) => typeof value === 'bigint' ? value.toString() : value); | ||
const patchRequest = (route, req) => { | ||
@@ -96,7 +97,7 @@ const patchedReq = req; | ||
if (res.original.status !== status) { | ||
const error = `Unexpected response ${res.original.status}: ${JSON.stringify(res.original.body)}`; | ||
const error = `Unexpected response ${res.original.status}: ${stringify(res.original.body)}`; | ||
throw new DecodeError(error, res); | ||
} | ||
else if (res.status === 'decodeError') { | ||
const error = `Could not decode response ${res.original.status}: ${JSON.stringify(res.original.body)}`; | ||
const error = `Could not decode response ${res.original.status}: [${stringify(res.original.body)}] due to error [${res.error}]`; | ||
throw new DecodeError(error, res); | ||
@@ -129,3 +130,3 @@ } | ||
request.set('content-type', 'application/json'); | ||
request = request.send(JSON.stringify(reqProps.body)); | ||
request = request.send(stringify(reqProps.body)); | ||
} | ||
@@ -132,0 +133,0 @@ return patchRequest(route, request); |
{ | ||
"name": "@api-ts/superagent-wrapper", | ||
"version": "1.0.0", | ||
"version": "1.1.1", | ||
"description": "Make type-safe HTTP requests with superagent", | ||
@@ -20,20 +20,20 @@ "author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>", | ||
"dependencies": { | ||
"@api-ts/io-ts-http": "1.0.0", | ||
"fp-ts": "2.12.3", | ||
"@api-ts/io-ts-http": "2.0.0", | ||
"fp-ts": "2.13.1", | ||
"io-ts": "2.1.3" | ||
}, | ||
"devDependencies": { | ||
"@types/superagent": "4.1.5", | ||
"@types/superagent": "4.1.15", | ||
"@types/supertest": "2.0.12", | ||
"@types/chai": "4.3.3", | ||
"@types/express": "4.17.13", | ||
"@types/mocha": "9.1.1", | ||
"body-parser": "1.20.0", | ||
"chai": "4.3.6", | ||
"express": "4.17.1", | ||
"io-ts-types": "0.5.16", | ||
"mocha": "10.0.0", | ||
"c8": "7.11.2", | ||
"superagent": "7.1.6", | ||
"supertest": "6.2.3", | ||
"@types/chai": "4.3.4", | ||
"@types/express": "4.17.14", | ||
"@types/mocha": "10.0.0", | ||
"body-parser": "1.20.1", | ||
"chai": "4.3.7", | ||
"express": "4.18.2", | ||
"io-ts-types": "0.5.19", | ||
"mocha": "10.1.0", | ||
"c8": "7.12.0", | ||
"superagent": "8.0.3", | ||
"supertest": "6.3.0", | ||
"ts-node": "10.9.1", | ||
@@ -40,0 +40,0 @@ "typescript": "4.7.4" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26004
256
+ Added@api-ts/io-ts-http@2.0.0(transitive)
+ Addedfp-ts@2.13.1(transitive)
+ Addedio-ts-types@0.5.19(transitive)
- Removed@api-ts/io-ts-http@1.0.0(transitive)
- Removedfp-ts@2.12.3(transitive)
- Removedio-ts-types@0.5.16(transitive)
Updated@api-ts/io-ts-http@2.0.0
Updatedfp-ts@2.13.1