Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dirty-trees-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/common-ts': patch
---

Minor update to BaseServiceV2 to keep the raw body around when requests are made.
10 changes: 9 additions & 1 deletion packages/common-ts/src/base-service/base-service-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,17 @@ export abstract class BaseServiceV2<
const app = express()

// Body parsing.
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))

// Keep the raw body around in case the application needs it.
app.use(
bodyParser.json({
verify: (req, res, buf, encoding) => {
;(req as any).rawBody = buf?.toString(encoding || 'utf8') || ''
},
})
)

// Logging.
app.use(
morgan('short', {
Expand Down