Skip to content

Commit a2c0827

Browse files
authored
Error: Cannot write headers after they are sent to the client (#54)
1 parent 62ce5b8 commit a2c0827

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "appium-interceptor",
3-
"version": "1.0.0-beta.12",
3+
"version": "1.0.1-beta.12",
44
"description": "Appium 2.0 plugin to mock api calls for android apps",
55
"main": "./lib/index.js",
66
"types": "./lib/types/index.d.ts",

src/proxy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,12 @@ export class Proxy {
220220
ctx.proxyToClientResponse.writeHead(mockConfig.statusCode);
221221
ctx.proxyToClientResponse.end(mockConfig.responseBody);
222222
} else {
223-
modifyResponseBody(ctx, mockConfig);
223+
try{
224+
modifyResponseBody(ctx, mockConfig);
225+
}catch (error) {
226+
log.error(`Error modifying response body: ${error}`);
227+
next();
228+
}
224229
next();
225230
}
226231
}

0 commit comments

Comments
 (0)