@friggframework/errors
Advanced tools
Comparing version 1.1.6-canary.e3d64e0.0 to 1.1.6
@@ -0,1 +1,15 @@ | ||
# v1.1.6 (Wed Feb 08 2023) | ||
#### 🐛 Bug Fix | ||
- URLSearchParams (used in OAuth2 base) was not printing out bodies in … [#124](https://github.com/friggframework/frigg/pull/124) ([@seanspeaks](https://github.com/seanspeaks)) | ||
- URLSearchParams (used in OAuth2 base) was not printing out bodies in error logs. ([@seanspeaks](https://github.com/seanspeaks)) | ||
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks)) | ||
#### Authors: 1 | ||
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks)) | ||
--- | ||
# v1.1.5 (Wed Jan 18 2023) | ||
@@ -2,0 +16,0 @@ |
@@ -13,3 +13,10 @@ const { BaseError } = require('./base-error'); | ||
const method = init?.method ?? 'GET'; | ||
const initText = init ? JSON.stringify({ init }, null, 2) : ''; | ||
const initText = init | ||
? init.body instanceof URLSearchParams | ||
? (() => { | ||
init.body = init.body.toString(); | ||
return JSON.stringify({ init }, null, 2); | ||
})() | ||
: JSON.stringify({ init }, null, 2) | ||
: ''; | ||
@@ -16,0 +23,0 @@ let responseBodyText = '<response body is unavailable>'; |
const fetch = require('node-fetch'); | ||
const { stripIndent } = require('common-tags'); | ||
const { FetchError } = require('./fetch-error'); | ||
const FormData = require('form-data'); | ||
@@ -54,2 +55,26 @@ describe('FetchError', () => { | ||
}); | ||
it.only('prints a formData body legibly', async () => { | ||
const response = { | ||
status: 500, | ||
statusText: 'Space aliens!', | ||
headers: Object.entries({ 'cache-control': '123' }), // needs to be an Iterable | ||
text: async () => '<!doctype html>', | ||
}; | ||
const params = new URLSearchParams(); | ||
params.append('test', 'test'); | ||
const init = { | ||
method: 'POST', | ||
credentials: 'include', | ||
headers: {}, | ||
query: {}, | ||
body: params, | ||
returnFullRes: false, | ||
}; | ||
const error = await FetchError.create({ response, init }); | ||
expect(error).toHaveProperty('message'); | ||
expect(error.message).toContain('test=test'); | ||
}); | ||
}); |
{ | ||
"name": "@friggframework/errors", | ||
"version": "1.1.6-canary.e3d64e0.0", | ||
"version": "1.1.6", | ||
"prettier": "@friggframework/prettier-config", | ||
@@ -8,3 +8,3 @@ "description": "", | ||
"devDependencies": { | ||
"@friggframework/eslint-config": "1.0.9-canary.e3d64e0.0", | ||
"@friggframework/eslint-config": "^1.0.8", | ||
"eslint": "^8.22.0", | ||
@@ -23,3 +23,3 @@ "jest": "^28.1.3", | ||
}, | ||
"gitHead": "e3d64e033a024a7211d58bf6bfe041a972bd8504" | ||
"gitHead": "ddaa7594712f23f65d31b1cd5cbbc22bf7977776" | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17415
346
1