Skip to content

Commit

Permalink
feat: include raw data in delivery payload (#55)
Browse files Browse the repository at this point in the history
Make the payload include the raw data of the delivery body. (Closes #9) (Closes #5)
  • Loading branch information
fourdollars authored Jul 23, 2024
1 parent 0e2451e commit 8c33d74
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ module.exports = (testRoute) => {
app.use(require('express-sslify').HTTPS({ trustProtoHeader: true }))
}

app.use((req, res, next) => {
var buf = ''
req.on('data', (chunk) => {
buf += chunk
})
req.on('end', () => {
req.rawdata = buf
})
next()
})

app.use(cors())
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
Expand Down Expand Up @@ -100,6 +111,7 @@ module.exports = (testRoute) => {
payload: {
...req.headers,
body: req.body,
rawdata: req.rawdata,
query: req.query,
timestamp: Date.now()
}
Expand Down

0 comments on commit 8c33d74

Please sign in to comment.