Skip to content

Commit

Permalink
Keep the raw data of the delivery body. (Closes probot#9) (Closes #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
fourdollars committed Jun 6, 2020
1 parent 3e9f1b7 commit 63bf1e2
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 63bf1e2

Please sign in to comment.