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

[#158] [#159] Add `formData()` API to Opine `Request` class #160

Closed asos-craigmorten closed 2 years ago

asos-craigmorten commented 2 years ago

Issue

Fixes #158 Fixes #159

Details

Adds a Request.formData() API to Opine for dealing with multipart/form-data.

CheckList

github-actions[bot] commented 2 years ago

Benchmark results

PR to merge feat/issue-158-159-multipart-form 1de24eec68098e912a745cdd0108bc96d207af90 -> main ```console opine: 1 middleware ================================ 1 middleware Running 3s test @ http://localhost:3333/?foo[bar]=baz 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 2.98ms 1.90ms 21.84ms 90.37% Req/Sec 1.80k 446.64 2.49k 54.84% Latency Distribution 50% 2.33ms 75% 3.04ms 90% 4.74ms 99% 12.08ms 11175 requests in 3.12s, 2.01MB read Requests/sec: 3583.56 Transfer/sec: 661.42KB opine: 10 middleware ================================ 10 middleware Running 3s test @ http://localhost:3333/?foo[bar]=baz 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 3.78ms 7.80ms 86.18ms 96.94% Req/Sec 1.89k 489.32 2.46k 68.75% Latency Distribution 50% 2.31ms 75% 2.77ms 90% 4.02ms 99% 54.14ms 12084 requests in 3.22s, 2.18MB read Requests/sec: 3758.47 Transfer/sec: 693.70KB opine: 50 middleware ================================ 50 middleware Running 3s test @ http://localhost:3333/?foo[bar]=baz 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 3.03ms 1.99ms 24.47ms 91.65% Req/Sec 1.79k 476.77 2.46k 67.74% Latency Distribution 50% 2.41ms 75% 3.06ms 90% 4.38ms 99% 12.90ms 11042 requests in 3.12s, 1.99MB read Requests/sec: 3542.98 Transfer/sec: 653.93KB std/http benchmark ================================ Server listening on localhost:3333 Running 3s test @ http://localhost:3333/?foo[bar]=baz 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 1.66ms 5.33ms 65.29ms 96.58% Req/Sec 6.45k 1.87k 8.56k 65.62% Latency Distribution 50% 627.00us 75% 815.00us 90% 1.60ms 99% 30.06ms 41087 requests in 3.21s, 3.41MB read Requests/sec: 12818.94 Transfer/sec: 1.06MB deno_http_native benchmark ================================ Server listening on localhost:3333 Running 3s test @ http://localhost:3333/?foo[bar]=baz 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 757.58us 723.07us 10.67ms 95.52% Req/Sec 7.39k 1.40k 8.63k 83.87% Latency Distribution 50% 601.00us 75% 668.00us 90% 0.87ms 99% 4.73ms 45622 requests in 3.10s, 3.79MB read Requests/sec: 14716.11 Transfer/sec: 1.22MB ```
fucksophie commented 2 years ago

i've attempted to implement this as a middleware which sounds more appropriate yourfriendoss@opine#91cfa4902d43116effd24abaed71ec1a2c0d4b69

asos-craigmorten commented 2 years ago

i've attempted to implement this as a middleware which sounds more appropriate yourfriendoss@opine#91cfa4902d43116effd24abaed71ec1a2c0d4b69

Yeah I like that - if you can raise a PR we can use that instead of this implementation.

asos-craigmorten commented 2 years ago

Closing in favour of #161