Skip to content

Commit 0488922

Browse files
author
djskinner
authored
Merge pull request #1702 from bugsnag/plat-6094
chore(plugin-express): send body in event.request
2 parents 07d5963 + f21fab8 commit 0488922

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## TBD
3+
## Unreleased
44

55
### Changed
66

@@ -11,7 +11,12 @@
1111
[bugsnag-android#1596](https://github.com/bugsnag/bugsnag-android/pull/1596)
1212
[bugsnag-android#1601](https://github.com/bugsnag/bugsnag-android/pull/1601)
1313

14-
### v7.16.2 (2022-03-09)
14+
### Fixed
15+
16+
- (plugin-express): send the request body (if present) as `event.request.body` rather than `event.metadata.request.body` [#1702](https://github.com/bugsnag/bugsnag-js/pull/1702)
17+
- (plugin-restify): Include request body [#1701](https://github.com/bugsnag/bugsnag-js/pull/1701)
18+
19+
## v7.16.2 (2022-03-09)
1520

1621
### Fixed
1722

@@ -21,7 +26,7 @@
2126

2227
- (plugin-react-navigation): Allow React Navigation v6 as a peer dependency [#1691](https://github.com/bugsnag/bugsnag-js/pull/1691)
2328

24-
### 7.16.1 (2022-02-02)
29+
## 7.16.1 (2022-02-02)
2530

2631
### Fixed
2732

packages/plugin-express/src/express.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ module.exports = {
7575
}
7676

7777
const getRequestAndMetadataFromReq = req => {
78-
const requestInfo = extractRequestInfo(req)
78+
const { body, ...requestInfo } = extractRequestInfo(req)
7979
return {
8080
metadata: requestInfo,
8181
request: {
82+
body,
8283
clientIp: requestInfo.clientIp,
8384
headers: requestInfo.headers,
8485
httpMethod: requestInfo.httpMethod,

test/node/features/express.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ Scenario: adding body to request metadata
116116
And the exception "message" equals "request body"
117117
And the exception "type" equals "nodejs"
118118
And the "file" of stack frame 0 equals "scenarios/app.js"
119-
And the event "metaData.request.body.data" equals "in_request_body"
119+
And the event "request.body.data" equals "in_request_body"
120120
And the event "request.httpMethod" equals "POST"

0 commit comments

Comments
 (0)