Skip to content

Commit 0a75699

Browse files
authored
Moved next() in handler to fix early HTTP response termination. (#2320)
* Moved next() in handler to fix early HTTP response termination. * Added changelog entry * Omit unnecessary next call from route handler * Fixed tests
1 parent 3226464 commit 0a75699

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## Unreleased
88
## Added
99
- [main] Bumped `electron` to v13.6.1 in PR [2318](https://github.com/microsoft/BotFramework-Emulator/pull/2318)
10-
10+
- [main] Fixed early restify route termination in `replyToActivity` handler in PR [2320](https://github.com/microsoft/BotFramework-Emulator/pull/2320)
11+
1112
## v4.14.0 - 2021 - 7 - 15
1213
## Added
1314
- [client] Bumped `botframework-webchat` to v4.14.0 in PR [2275](https://github.com/microsoft/BotFramework-Emulator/pull/2275)

packages/app/main/src/server/routes/channel/conversations/handlers/replyToActivity.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ describe('replyToActivity route middleware', () => {
105105
});
106106
expect(mockRes.send).toHaveBeenCalledWith(OK, { id: 'someActivityId' });
107107
expect(mockRes.end).toHaveBeenCalled();
108-
expect(mockNext).toHaveBeenCalled();
109108
});
110109

111110
it('should resolve any OAuth cards, post the activity (with a null id) to the user, and send an OK response', async () => {
@@ -123,7 +122,6 @@ describe('replyToActivity route middleware', () => {
123122
});
124123
expect(mockRes.send).toHaveBeenCalledWith(OK, { id: null });
125124
expect(mockRes.end).toHaveBeenCalled();
126-
expect(mockNext).toHaveBeenCalled();
127125

128126
mockReq.body.id = 'someActivityId';
129127
});
@@ -147,6 +145,5 @@ describe('replyToActivity route middleware', () => {
147145
});
148146
expect(mockRes.send).toHaveBeenCalledWith(OK, { id: 'someActivityId' });
149147
expect(mockRes.end).toHaveBeenCalled();
150-
expect(mockNext).toHaveBeenCalled();
151148
});
152149
});

packages/app/main/src/server/routes/channel/conversations/handlers/replyToActivity.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,5 @@ export function createReplyToActivityHandler(emulatorServer: EmulatorRestServer)
8585
} catch (err) {
8686
sendErrorResponse(req, res, next, err);
8787
}
88-
89-
next();
9088
};
9189
}

0 commit comments

Comments
 (0)