Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "objective-http",
"version": "2.1.3",
"version": "2.1.4",
"description": "Proxy classes for creating a http server",
"keywords": [
"web",
Expand All @@ -24,8 +24,8 @@
"test:coverage": "node scripts/coverage.js",
"release": "release-it --config release-it.config.mjs",
"release:no-increment": "release-it --ci --config release-it.config.mjs --no-increment --no-git",
"dist:build": "webpack --config webpack.config.mjs",
"dist:cleanup": "node scripts/cleanup.js"
"build": "webpack --config webpack.config.mjs",
"build:cleanup": "node scripts/cleanup.js"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions release-it.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export default {
},
hooks: {
'before:init': [
'npm run dist:cleanup',
'npm run build:cleanup',
'npm run lint',
'npm run test:coverage',
],
'before:npm:release': ['npm run dist:build'],
'after:npm:release': ['npm run dist:cleanup'],
'before:npm:release': ['npm run build'],
'after:npm:release': ['npm run build:cleanup'],
},
};
4 changes: 2 additions & 2 deletions src/js/client/request/chunk/JsonClientRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ module.exports = class JsonClientRequest {
return this.#origin.response;
}

send() {
return this.#origin
async send() {
return await this.#origin
.with({
body: this.body,
options: this.options,
Expand Down
11 changes: 7 additions & 4 deletions src/js/client/response/chunk/JsonClientResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ module.exports = class JsonClientResponse {
}),
});
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Error('JSON client response error', {
cause: { error: e, code: 'RESPONSE_ERROR' },
});
if (e instanceof SyntaxError) {
throw new Error(
`Invalid client json response. Body was ${accepted.body}`,
{
cause: { error: e, code: 'RESPONSE_ERROR' },
},
);
}

throw e;
Expand Down
9 changes: 6 additions & 3 deletions src/js/server/request/chunk/JsonServerRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ module.exports = class JsonServerRequest {
});
} catch (e) {
if (e instanceof SyntaxError) {
throw new Error('Invalid server json request', {
cause: { error: e, code: 'INVALID_REQUEST' },
});
throw new Error(
`Invalid server json request. Body was ${accepted.body}`,
{
cause: { error: e, code: 'INVALID_REQUEST' },
},
);
}

throw e;
Expand Down
Loading