Skip to content

Commit

Permalink
Fix #39, turn off cors (#40)
Browse files Browse the repository at this point in the history
- Fix #39 
- Address issue with `cors` mode see
httptoolkit/mockttp#156
  • Loading branch information
ballercat authored Oct 26, 2023
1 parent 29a633b commit 643151f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.0.30 - Turn off cors mode

- Turn off cors mode fix issue with multi headers
- Fix #39

## 0.0.29 - Fix SKPI Fingerprint, minor improvements

- Fix SKPI fingerprint
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jambox",
"version": "0.0.29",
"version": "0.0.30",
"description": "Tool for recording and playing back HTTP requests.",
"bin": {
"jam": "./jam.mjs",
Expand Down
1 change: 0 additions & 1 deletion src/server/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const getServices = (filesystem) => {
const ews = expessWS(app);
const cache = new Cache();
const proxy = mockttp.getLocal({
cors: true,
recordTraffic: false,
suggestChanges: false,
https: {
Expand Down
7 changes: 5 additions & 2 deletions src/utils/serialize.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ export const updateResponse = async (prev, curr) => {
...rest,
};

// Update the final buffer and content length
result.body.buffer = buffer;
result.headers['content-length'] = buffer.length;

// Update the final buffer and content length
if ('content-length' in result.headers) {
result.headers['content-length'] = buffer.length;
}

return result;
};

0 comments on commit 643151f

Please sign in to comment.