cmorten / opine

Minimalist web framework for Deno ported from ExpressJS.
https://github.com/cmorten/opine/blob/main/.github/API/api.md
MIT License
854 stars 43 forks source link

[#26] Implement request body proxy #95

Closed cmorten closed 3 years ago

cmorten commented 3 years ago

Issue

Fixes #26.

Details

Implements a proxy to allow users to overwrite the req.body property (e.g. via body parsers) rather than have to reference a new parsedBody property.

To allow access to the original body, a req.raw property has been implemented.

The req.parsedBody has been left in place for backward compatibility reasons.

This is a breaking change as it changes the characteristics of the req.body property, which is fairly central to Opine and general request / server usage and patterns.

Hat tip to @DxSimonovski and their contribution https://github.com/asos-craigmorten/opine/pull/86. Too impatient to get this in so cherry picked bits and pieces to get it across the line! 😅

CheckList