Skip to content

Commit

Permalink
Moved next() in handler to fix early HTTP response termination. (#2320)
Browse files Browse the repository at this point in the history
* Moved next() in handler to fix early HTTP response termination.

* Added changelog entry

* Omit unnecessary next call from route handler

* Fixed tests
  • Loading branch information
tonyanziano committed Nov 11, 2021
1 parent 3226464 commit 0a75699
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
## Added
- [main] Bumped `electron` to v13.6.1 in PR [2318](https://github.com/microsoft/BotFramework-Emulator/pull/2318)

- [main] Fixed early restify route termination in `replyToActivity` handler in PR [2320](https://github.com/microsoft/BotFramework-Emulator/pull/2320)

## v4.14.0 - 2021 - 7 - 15
## Added
- [client] Bumped `botframework-webchat` to v4.14.0 in PR [2275](https://github.com/microsoft/BotFramework-Emulator/pull/2275)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ describe('replyToActivity route middleware', () => {
});
expect(mockRes.send).toHaveBeenCalledWith(OK, { id: 'someActivityId' });
expect(mockRes.end).toHaveBeenCalled();
expect(mockNext).toHaveBeenCalled();
});

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

mockReq.body.id = 'someActivityId';
});
Expand All @@ -147,6 +145,5 @@ describe('replyToActivity route middleware', () => {
});
expect(mockRes.send).toHaveBeenCalledWith(OK, { id: 'someActivityId' });
expect(mockRes.end).toHaveBeenCalled();
expect(mockNext).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,5 @@ export function createReplyToActivityHandler(emulatorServer: EmulatorRestServer)
} catch (err) {
sendErrorResponse(req, res, next, err);
}

next();
};
}

0 comments on commit 0a75699

Please sign in to comment.