Skip to content

Commit

Permalink
Error: Cannot write headers after they are sent to the client (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnilPatidar authored Nov 18, 2024
1 parent 62ce5b8 commit a2c0827
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "appium-interceptor",
"version": "1.0.0-beta.12",
"version": "1.0.1-beta.12",
"description": "Appium 2.0 plugin to mock api calls for android apps",
"main": "./lib/index.js",
"types": "./lib/types/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@ export class Proxy {
ctx.proxyToClientResponse.writeHead(mockConfig.statusCode);
ctx.proxyToClientResponse.end(mockConfig.responseBody);
} else {
modifyResponseBody(ctx, mockConfig);
try{
modifyResponseBody(ctx, mockConfig);
}catch (error) {
log.error(`Error modifying response body: ${error}`);
next();
}
next();
}
}
Expand Down

0 comments on commit a2c0827

Please sign in to comment.