Repository: swaggest/rest
Pull request #131 (2023-01-29 23:54:41)

Add request.Setter interface to capture http.Request

github-actions[bot]: ### Lines Of Code

| Language  | Files |   Lines    |    Code    | Comments |  Blanks   | Complexity |     Bytes      |
|-----------|-------|------------|------------|----------|-----------|------------|----------------|
| Go        | 105   | 7468 (+16) | 5424 (+10) | 496 (+3) | 1548 (+3) | 921 (+9)   | 180.5K (+388B) |
| Go (test) | 47    | 5193 (+28) | 3975 (+21) | 185      | 1033 (+7) | 179        | 145.1K (+789B) |
<!-- Sticky Pull Request CommentLOC -->
github-actions[bot]: ### Go API Changes

<pre>
# github.com/swaggest/rest/request
## compatible changes
Setter: added

# summary
Inferred base version: v0.2.39
Suggested version: v0.3.0
</pre>
<!-- Sticky Pull Request Commentgorelease -->
github-actions[bot]: ### Unit Test Coverage
total:								(statements)			83.2%
changed lines: (statements) 88.9%, coverage is less than 90.0%, consider testing the changes more thoroughly
<details><summary>Coverage of changed lines</summary>

|              File               |  Function   | Coverage |
|---------------------------------|-------------|----------|
| Total                           |             | 88.9%    |
| request/decoder.go              |             | 100.0%   |
| request/decoder.go:83           | Decode      | 100.0%   |
| response/gzip/middleware.go     |             | 85.7%    |
| response/gzip/middleware.go:153 | writeHeader | 87.5%    |

</details>

<details><summary>Coverage diff with base branch</summary>

|                         File                         |  Function   | Base Coverage | Current Coverage |
|------------------------------------------------------|-------------|---------------|------------------|
| Total                                                |             | 83.2%         | 83.2% (0.0%)     |
| github.com/swaggest/rest/response/gzip/middleware.go | writeHeader | 100.0%        | 94.7% (-5.3%)    |

</details>
<!-- Sticky Pull Request Commentunit-test -->
codecov[bot]: # [Codecov](https://codecov.io/gh/swaggest/rest/pull/131?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) Report
> Merging [#131](https://codecov.io/gh/swaggest/rest/pull/131?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) (5e7a377) into [master](https://codecov.io/gh/swaggest/rest/commit/12f37c79adc554847dd273fa9fe2b6b33448bddc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) (12f37c7) will **decrease** coverage by `0.06%`.
> The diff coverage is `66.66%`.

```diff
@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
- Coverage   77.40%   77.34%   -0.06%     
==========================================
  Files          28       28              
  Lines        1562     1567       +5     
==========================================
+ Hits         1209     1212       +3     
- Misses        232      233       +1     
- Partials      121      122       +1     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `77.34% <66.66%> (-0.06%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/swaggest/rest/pull/131?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) | Coverage Δ | |
|---|---|---|
| [response/gzip/middleware.go](https://codecov.io/gh/swaggest/rest/pull/131?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest#diff-cmVzcG9uc2UvZ3ppcC9taWRkbGV3YXJlLmdv) | `77.55% <50.00%> (-1.40%)` | :arrow_down: |
| [request/decoder.go](https://codecov.io/gh/swaggest/rest/pull/131?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest#diff-cmVxdWVzdC9kZWNvZGVyLmdv) | `66.07% <100.00%> (+1.25%)` | :arrow_up: |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest)

github-actions[bot]: ### Benchmark Result
<details><summary>Benchmark diff with base branch</summary>

```
name                                    old time/op    new time/op    delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    1.59µs ± 9%    1.55µs ± 3%    ~     (p=0.931 n=6+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                           827ns ± 2%     851ns ± 1%  +2.95%  (p=0.004 n=6+5)
DecoderFunc_Decode-2                      2.34µs ± 2%    2.37µs ± 1%  +1.43%  (p=0.041 n=6+6)
Decoder_Decode_json-2                     25.3µs ± 1%    25.9µs ± 1%  +2.56%  (p=0.004 n=5+6)
Decoder_Decode_queryObject-2              5.45µs ± 0%    5.51µs ± 0%  +1.13%  (p=0.004 n=6+5)
Decoder_Decode_jsonParam-2                2.05µs ± 0%    2.08µs ± 1%  +1.39%  (p=0.002 n=6+6)
DecoderFactory_SetDecoderFunc-2           1.92µs ± 0%    1.96µs ± 0%  +1.89%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              13.3µs ± 1%    13.4µs ± 1%    ~     (p=0.177 n=5+6)
Middleware_control-2                      4.04µs ± 5%    3.98µs ± 0%    ~     (p=0.937 n=6+6)

name                                    old alloc/op   new alloc/op   delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    2.46kB ± 0%    2.46kB ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                            440B ± 0%      440B ± 0%    ~     (all equal)
DecoderFunc_Decode-2                      1.51kB ± 0%    1.51kB ± 0%    ~     (all equal)
Decoder_Decode_json-2                     12.2kB ± 0%    12.2kB ± 0%    ~     (all equal)
Decoder_Decode_queryObject-2              2.00kB ± 0%    2.00kB ± 0%    ~     (all equal)
Decoder_Decode_jsonParam-2                  736B ± 0%      736B ± 0%    ~     (all equal)
DecoderFactory_SetDecoderFunc-2           1.02kB ± 0%    1.02kB ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              1.17kB ± 3%    1.18kB ± 2%    ~     (p=0.662 n=6+5)
Middleware_control-2                      11.2kB ± 0%    11.2kB ± 0%    ~     (all equal)

name                                    old allocs/op  new allocs/op  delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2      8.00 ± 0%      8.00 ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                            4.00 ± 0%      4.00 ± 0%    ~     (all equal)
DecoderFunc_Decode-2                        12.0 ± 0%      12.0 ± 0%    ~     (all equal)
Decoder_Decode_json-2                        177 ± 0%       177 ± 0%    ~     (all equal)
Decoder_Decode_queryObject-2                36.0 ± 0%      36.0 ± 0%    ~     (all equal)
Decoder_Decode_jsonParam-2                  13.0 ± 0%      13.0 ± 0%    ~     (all equal)
DecoderFactory_SetDecoderFunc-2             16.0 ± 0%      16.0 ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                                11.0 ± 0%      11.0 ± 0%    ~     (all equal)
Middleware_control-2                        9.00 ± 0%      9.00 ± 0%    ~     (all equal)
```
</details>

<details><summary>Benchmark result</summary>

```
name                                    time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  1.55µs ± 3%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                         851ns ± 1%
DecoderFunc_Decode-2                    2.37µs ± 1%
Decoder_Decode_json-2                   25.9µs ± 1%
Decoder_Decode_queryObject-2            5.51µs ± 0%
Decoder_Decode_jsonParam-2              2.08µs ± 1%
DecoderFactory_SetDecoderFunc-2         1.96µs ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            13.4µs ± 1%
Middleware_control-2                    3.98µs ± 0%

name                                    alloc/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  2.46kB ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                          440B ± 0%
DecoderFunc_Decode-2                    1.51kB ± 0%
Decoder_Decode_json-2                   12.2kB ± 0%
Decoder_Decode_queryObject-2            2.00kB ± 0%
Decoder_Decode_jsonParam-2                736B ± 0%
DecoderFactory_SetDecoderFunc-2         1.02kB ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            1.18kB ± 2%
Middleware_control-2                    11.2kB ± 0%

name                                    allocs/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    8.00 ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                          4.00 ± 0%
DecoderFunc_Decode-2                      12.0 ± 0%
Decoder_Decode_json-2                      177 ± 0%
Decoder_Decode_queryObject-2              36.0 ± 0%
Decoder_Decode_jsonParam-2                13.0 ± 0%
DecoderFactory_SetDecoderFunc-2           16.0 ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              11.0 ± 0%
Middleware_control-2                      9.00 ± 0%
```
</details>
<!-- Sticky Pull Request Commentbench -->
github-actions[bot]: ### Examples Benchmark Result
<details><summary>Benchmark diff with base branch</summary>

```
name                       old time/op    new time/op    delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                24.6µs ± 1%    26.1µs ±12%     ~     (p=0.063 n=4+5)
_directGzipHead-2            24.5µs ± 1%    25.5µs ± 2%   +3.93%  (p=0.008 n=5+5)
_noDirectGzip-2               128µs ± 1%     128µs ± 1%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          449µs ± 1%     460µs ± 1%   +2.28%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        128µs ± 4%     129µs ± 1%     ~     (p=0.151 n=5+5)
_jsonBody-2                  44.6µs ± 2%    47.0µs ± 1%   +5.36%  (p=0.008 n=5+5)
_jsonBodyValidation-2        50.9µs ± 1%    53.1µs ± 1%   +4.29%  (p=0.008 n=5+5)
_outputHeaders-2             24.0µs ± 2%    25.0µs ± 2%   +4.41%  (p=0.008 n=5+5)
_requestResponseMapping-2    45.1µs ± 4%    45.4µs ± 4%     ~     (p=0.690 n=5+5)
_validation-2                47.5µs ± 4%    48.9µs ± 8%     ~     (p=0.421 n=5+5)
_noValidation-2              35.0µs ± 2%    36.2µs ± 2%   +3.59%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                26.5µs ± 4%    26.4µs ± 2%     ~     (p=0.841 n=5+5)
_directGzipHead-2            26.0µs ± 1%    26.4µs ± 0%   +1.52%  (p=0.016 n=5+4)
_noDirectGzip-2               131µs ± 1%     134µs ± 1%   +2.27%  (p=0.008 n=5+5)
_directGzip_decode-2          469µs ± 2%     466µs ± 2%     ~     (p=0.310 n=5+5)
_noDirectGzip_decode-2        131µs ± 1%     132µs ± 1%     ~     (p=0.063 n=5+4)
_htmlResponse-2              40.3µs ± 1%    41.2µs ± 2%   +2.33%  (p=0.032 n=5+5)
_jsonBodyManual-2            28.6µs ± 1%    29.6µs ± 2%   +3.42%  (p=0.008 n=5+5)
_jsonBody-2                  41.9µs ± 3%    42.8µs ± 2%   +2.33%  (p=0.032 n=5+5)
_jsonBodyValidation-2        53.2µs ± 2%    54.7µs ± 2%   +2.82%  (p=0.032 n=5+5)
_outputHeaders-2             25.9µs ± 2%    26.9µs ± 2%   +3.75%  (p=0.008 n=5+5)
_requestResponseMapping-2    45.5µs ± 2%    47.4µs ± 4%   +4.21%  (p=0.032 n=5+5)
_validation-2                48.4µs ± 1%    50.2µs ± 1%   +3.75%  (p=0.008 n=5+5)
_noValidation-2              35.1µs ± 3%    37.0µs ± 2%   +5.50%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               28.6µs ± 9%    28.3µs ± 1%     ~     (p=0.421 n=5+5)
_ok-2                        28.8µs ± 2%    29.2µs ± 1%     ~     (p=0.413 n=5+4)
_invalidBody-2               40.4µs ± 1%    40.8µs ± 1%   +1.08%  (p=0.032 n=5+5)

name                       old 50%:ms     new 50%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  1.17 ± 2%      1.23 ± 2%   +5.18%  (p=0.008 n=5+5)
_directGzipHead-2              1.16 ± 6%      1.17 ± 4%     ~     (p=0.310 n=5+5)
_noDirectGzip-2                6.18 ± 4%      6.34 ± 4%     ~     (p=0.310 n=5+5)
_directGzip_decode-2           17.9 ± 7%      18.2 ± 5%     ~     (p=0.595 n=5+5)
_noDirectGzip_decode-2         6.11 ± 4%      6.24 ± 3%     ~     (p=0.222 n=5+5)
_jsonBody-2                    2.03 ± 8%      2.13 ± 4%     ~     (p=0.056 n=5+5)
_jsonBodyValidation-2          2.25 ± 4%      2.38 ± 5%   +5.99%  (p=0.016 n=5+5)
_outputHeaders-2               1.13 ±11%      1.15 ± 5%     ~     (p=0.310 n=5+5)
_requestResponseMapping-2      1.97 ± 6%      1.96 ± 9%     ~     (p=1.000 n=5+5)
_validation-2                  2.09 ± 3%      2.14 ± 7%     ~     (p=0.310 n=5+5)
_noValidation-2                1.57 ± 7%      1.61 ± 6%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  1.24 ± 4%      1.23 ± 8%     ~     (p=0.452 n=5+5)
_directGzipHead-2              1.24 ± 6%      1.25 ± 5%     ~     (p=0.595 n=5+5)
_noDirectGzip-2                6.33 ± 5%      6.54 ± 3%     ~     (p=0.222 n=5+5)
_directGzip_decode-2           18.3 ± 4%      18.4 ± 5%     ~     (p=0.841 n=5+5)
_noDirectGzip_decode-2         6.33 ± 7%      6.52 ± 7%     ~     (p=0.310 n=5+5)
_htmlResponse-2                1.83 ± 8%      1.88 ± 3%     ~     (p=0.143 n=5+5)
_jsonBodyManual-2              1.34 ± 6%      1.41 ± 6%     ~     (p=0.151 n=5+5)
_jsonBody-2                    1.82 ± 3%      1.91 ± 7%   +5.07%  (p=0.016 n=5+5)
_jsonBodyValidation-2          2.37 ± 6%      2.37 ± 3%     ~     (p=1.000 n=5+5)
_outputHeaders-2               1.21 ± 7%      1.24 ± 6%     ~     (p=0.246 n=5+5)
_requestResponseMapping-2      1.94 ± 3%      2.03 ± 5%     ~     (p=0.056 n=5+5)
_validation-2                  2.07 ± 5%      2.19 ± 4%     ~     (p=0.095 n=5+5)
_noValidation-2                1.55 ± 2%      1.60 ± 3%     ~     (p=0.063 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 1.39 ± 8%      1.37 ± 5%     ~     (p=0.841 n=5+5)
_ok-2                          1.38 ± 4%      1.41 ± 8%     ~     (p=0.690 n=5+5)
_invalidBody-2                 1.82 ± 7%      1.81 ± 7%     ~     (p=1.000 n=5+5)

name                       old 90%:ms     new 90%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  2.10 ± 4%      2.15 ±10%     ~     (p=0.690 n=5+5)
_directGzipHead-2              2.04 ± 6%      2.17 ± 4%   +6.22%  (p=0.032 n=5+5)
_noDirectGzip-2                11.2 ± 4%      11.1 ± 4%     ~     (p=0.690 n=5+5)
_directGzip_decode-2           36.6 ± 2%      38.7 ± 6%     ~     (p=0.056 n=5+5)
_noDirectGzip_decode-2         11.2 ± 5%      11.3 ± 3%     ~     (p=1.000 n=5+5)
_jsonBody-2                    4.15 ± 4%      4.29 ± 2%     ~     (p=0.056 n=5+5)
_jsonBodyValidation-2          4.71 ± 4%      4.80 ± 5%     ~     (p=0.421 n=5+5)
_outputHeaders-2               1.96 ± 7%      2.05 ± 5%     ~     (p=0.095 n=5+5)
_requestResponseMapping-2      4.17 ± 6%      4.28 ± 5%     ~     (p=0.690 n=5+5)
_validation-2                  4.42 ± 7%      4.56 ± 6%     ~     (p=0.095 n=5+5)
_noValidation-2                3.11 ± 5%      3.37 ± 7%   +8.37%  (p=0.016 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  2.23 ± 6%      2.18 ± 4%     ~     (p=0.310 n=5+5)
_directGzipHead-2              2.21 ± 3%      2.26 ± 7%     ~     (p=0.421 n=5+5)
_noDirectGzip-2                11.3 ± 6%      11.9 ± 5%     ~     (p=0.151 n=5+5)
_directGzip_decode-2           39.5 ± 4%      39.0 ±10%     ~     (p=0.841 n=5+5)
_noDirectGzip_decode-2         11.4 ± 3%      11.4 ± 3%     ~     (p=0.548 n=5+5)
_htmlResponse-2                3.55 ± 5%      3.69 ± 5%     ~     (p=0.151 n=5+5)
_jsonBodyManual-2              2.41 ± 5%      2.48 ± 6%     ~     (p=0.310 n=5+5)
_jsonBody-2                    3.84 ± 4%      4.09 ± 3%   +6.53%  (p=0.032 n=5+5)
_jsonBodyValidation-2          4.90 ± 2%      5.25 ± 5%   +7.22%  (p=0.008 n=5+5)
_outputHeaders-2               2.18 ± 5%      2.24 ± 4%     ~     (p=0.421 n=5+5)
_requestResponseMapping-2      4.36 ± 8%      4.63 ± 8%     ~     (p=0.222 n=5+5)
_validation-2                  4.74 ± 2%      4.71 ± 1%     ~     (p=0.310 n=5+5)
_noValidation-2                3.14 ± 4%      3.28 ± 6%     ~     (p=0.056 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 2.38 ± 4%      2.41 ± 7%     ~     (p=0.452 n=5+5)
_ok-2                          2.45 ± 6%      2.45 ± 4%     ~     (p=1.000 n=5+5)
_invalidBody-2                 3.66 ± 6%      3.81 ± 8%     ~     (p=0.151 n=5+5)

name                       old 99%:ms     new 99%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  3.55 ± 3%      3.61 ± 9%     ~     (p=1.000 n=4+4)
_directGzipHead-2              3.61 ± 2%      3.89 ± 6%   +7.92%  (p=0.008 n=5+5)
_noDirectGzip-2                15.6 ±12%      15.3 ± 4%     ~     (p=1.000 n=5+5)
_directGzip_decode-2           61.5 ± 5%      65.0 ±11%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2         15.5 ±21%      15.0 ± 3%     ~     (p=1.000 n=5+5)
_jsonBody-2                    6.78 ±19%      6.65 ± 3%     ~     (p=0.548 n=5+5)
_jsonBodyValidation-2          8.29 ±10%      7.58 ± 8%     ~     (p=0.095 n=5+5)
_outputHeaders-2               4.19 ± 8%      4.39 ± 6%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2      7.38 ±24%      6.72 ± 9%     ~     (p=0.222 n=5+5)
_validation-2                  6.87 ±11%      7.63 ±24%     ~     (p=0.690 n=5+5)
_noValidation-2                6.18 ±14%      5.97 ± 4%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  4.71 ±51%      4.12 ±12%     ~     (p=0.841 n=5+5)
_directGzipHead-2              4.06 ± 6%      4.06 ± 4%     ~     (p=1.000 n=5+4)
_noDirectGzip-2                15.7 ±11%      16.2 ± 4%     ~     (p=0.151 n=5+5)
_directGzip_decode-2           65.9 ± 5%      69.5 ± 8%     ~     (p=0.389 n=5+5)
_noDirectGzip_decode-2         15.2 ± 6%      16.1 ±20%     ~     (p=0.690 n=5+5)
_htmlResponse-2                6.22 ± 2%      6.46 ± 9%     ~     (p=1.000 n=5+5)
_jsonBodyManual-2              4.61 ± 8%      4.87 ±15%     ~     (p=0.421 n=5+5)
_jsonBody-2                    7.08 ±12%      6.94 ± 9%     ~     (p=0.548 n=5+5)
_jsonBodyValidation-2          8.19 ±16%      8.47 ±18%     ~     (p=0.548 n=5+5)
_outputHeaders-2               4.42 ± 2%      4.70 ± 9%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2      7.33 ± 9%      7.61 ±16%     ~     (p=0.841 n=5+5)
_validation-2                  7.77 ± 8%      7.83 ±12%     ~     (p=0.841 n=5+5)
_noValidation-2                6.04 ± 9%      6.32 ±10%     ~     (p=0.310 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 3.87 ± 6%      3.86 ± 5%     ~     (p=1.000 n=4+5)
_ok-2                          4.17 ±13%      4.44 ± 5%     ~     (p=0.286 n=5+4)
_invalidBody-2                 6.84 ±14%      6.80 ±14%     ~     (p=0.690 n=5+5)

name                       old 99.9%:ms   new 99.9%:ms   delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  5.31 ± 9%      8.61 ±61%  +62.11%  (p=0.016 n=4+5)
_directGzipHead-2              7.15 ±42%      7.76 ±31%     ~     (p=0.690 n=5+5)
_noDirectGzip-2                21.1 ±18%      20.2 ±31%     ~     (p=1.000 n=5+5)
_directGzip_decode-2           78.8 ± 8%      81.4 ±18%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-2         22.0 ±57%      19.7 ± 7%     ~     (p=0.841 n=5+5)
_jsonBody-2                    10.9 ±29%       9.0 ±19%     ~     (p=0.095 n=5+5)
_jsonBodyValidation-2          13.0 ±21%      11.6 ± 6%     ~     (p=0.151 n=5+5)
_outputHeaders-2               10.2 ±25%      11.1 ±26%     ~     (p=0.548 n=5+5)
_requestResponseMapping-2      16.1 ±36%      10.6 ±28%  -34.08%  (p=0.016 n=5+5)
_validation-2                  12.3 ±28%      12.3 ±51%     ~     (p=1.000 n=5+5)
_noValidation-2                12.1 ±29%      11.5 ±22%     ~     (p=0.841 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  10.5 ±44%       8.0 ±28%     ~     (p=0.222 n=5+5)
_directGzipHead-2              7.09 ±21%    10.02 ±100%     ~     (p=0.095 n=5+5)
_noDirectGzip-2                20.3 ±18%      20.7 ± 6%     ~     (p=0.690 n=5+5)
_directGzip_decode-2           82.7 ± 8%     100.3 ±42%     ~     (p=0.175 n=5+5)
_noDirectGzip_decode-2         18.7 ± 9%      20.2 ±30%     ~     (p=0.841 n=5+5)
_htmlResponse-2                12.1 ±35%      10.6 ±33%     ~     (p=0.690 n=5+5)
_jsonBodyManual-2              7.87 ±24%      9.59 ±27%     ~     (p=0.222 n=5+5)
_jsonBody-2                    14.0 ±26%      12.1 ±34%     ~     (p=0.310 n=5+5)
_jsonBodyValidation-2          13.2 ±22%      12.4 ±22%     ~     (p=0.690 n=5+5)
_outputHeaders-2               9.59 ±32%     10.78 ±30%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2      14.7 ±26%      14.1 ±10%     ~     (p=0.690 n=5+5)
_validation-2                  14.5 ±25%      12.3 ±20%     ~     (p=0.548 n=5+5)
_noValidation-2                10.6 ±22%      10.0 ±21%     ~     (p=0.690 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 5.99 ±12%      6.22 ±35%     ~     (p=0.730 n=4+5)
_ok-2                          9.09 ±29%     10.68 ±56%     ~     (p=0.841 n=5+5)
_invalidBody-2                 11.1 ±23%      11.4 ±53%     ~     (p=0.690 n=5+5)

name                       old B:rcvd/op  new B:rcvd/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                   630 ± 0%       630 ± 0%     ~     (all equal)
_directGzipHead-2               174 ± 0%       174 ± 0%     ~     (all equal)
_noDirectGzip-2               1.03k ± 0%     1.03k ± 0%     ~     (all equal)
_directGzip_decode-2            630 ± 0%       630 ± 0%     ~     (all equal)
_noDirectGzip_decode-2        1.03k ± 0%     1.03k ± 0%     ~     (all equal)
_jsonBody-2                     199 ± 0%       199 ± 0%     ~     (all equal)
_jsonBodyValidation-2           185 ± 0%       185 ± 0%     ~     (all equal)
_outputHeaders-2                146 ± 0%       146 ± 0%     ~     (all equal)
_requestResponseMapping-2      94.0 ± 0%      94.0 ± 0%     ~     (all equal)
_validation-2                   168 ± 0%       168 ± 0%     ~     (all equal)
_noValidation-2                 168 ± 0%       168 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                   638 ± 0%       638 ± 0%     ~     (all equal)
_directGzipHead-2               182 ± 0%       182 ± 0%     ~     (all equal)
_noDirectGzip-2               1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_directGzip_decode-2            638 ± 0%       638 ± 0%     ~     (all equal)
_noDirectGzip_decode-2        1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_htmlResponse-2                 355 ± 0%       355 ± 0%     ~     (all equal)
_jsonBodyManual-2               207 ± 0%       207 ± 0%     ~     (all equal)
_jsonBody-2                     207 ± 0%       207 ± 0%     ~     (all equal)
_jsonBodyValidation-2           193 ± 0%       193 ± 0%     ~     (all equal)
_outputHeaders-2                185 ± 0%       185 ± 0%     ~     (all equal)
_requestResponseMapping-2       108 ± 0%       108 ± 0%     ~     (all equal)
_validation-2                   176 ± 0%       176 ± 0%     ~     (all equal)
_noValidation-2                 176 ± 0%       176 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                  322 ± 0%       322 ± 0%     ~     (all equal)
_ok-2                           344 ± 0%       344 ± 0%     ~     (all equal)
_invalidBody-2                  420 ± 0%       420 ± 0%     ~     (all equal)

name                       old B:sent/op  new B:sent/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                   103 ± 0%       103 ± 0%     ~     (all equal)
_directGzipHead-2               104 ± 0%       104 ± 0%     ~     (all equal)
_noDirectGzip-2                 117 ± 0%       117 ± 0%     ~     (all equal)
_directGzip_decode-2            116 ± 0%       116 ± 0%     ~     (all equal)
_noDirectGzip_decode-2          130 ± 0%       130 ± 0%     ~     (all equal)
_jsonBody-2                     188 ± 0%       188 ± 0%     ~     (all equal)
_jsonBodyValidation-2           192 ± 0%       192 ± 0%     ~     (all equal)
_outputHeaders-2               77.0 ± 0%      77.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       169 ± 0%       169 ± 0%     ~     (all equal)
_validation-2                   170 ± 0%       170 ± 0%     ~     (all equal)
_noValidation-2                 173 ± 0%       173 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                   103 ± 0%       103 ± 0%     ~     (all equal)
_directGzipHead-2               104 ± 0%       104 ± 0%     ~     (all equal)
_noDirectGzip-2                 117 ± 0%       117 ± 0%     ~     (all equal)
_directGzip_decode-2            116 ± 0%       116 ± 0%     ~     (all equal)
_noDirectGzip_decode-2          130 ± 0%       130 ± 0%     ~     (all equal)
_htmlResponse-2                 108 ± 0%       108 ± 0%     ~     (all equal)
_jsonBodyManual-2               195 ± 0%       195 ± 0%     ~     (all equal)
_jsonBody-2                     188 ± 0%       188 ± 0%     ~     (all equal)
_jsonBodyValidation-2           192 ± 0%       192 ± 0%     ~     (all equal)
_outputHeaders-2               77.0 ± 0%      77.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       169 ± 0%       169 ± 0%     ~     (all equal)
_validation-2                   170 ± 0%       170 ± 0%     ~     (all equal)
_noValidation-2                 173 ± 0%       173 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 74.0 ± 0%      74.0 ± 0%     ~     (all equal)
_ok-2                          74.0 ± 0%      74.0 ± 0%     ~     (all equal)
_invalidBody-2                  137 ± 0%       137 ± 0%     ~     (all equal)

name                       old rps        new rps        delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                 40.7k ± 1%     38.5k ±11%     ~     (p=0.063 n=4+5)
_directGzipHead-2             40.7k ± 1%     39.2k ± 2%   -3.78%  (p=0.008 n=5+5)
_noDirectGzip-2               7.80k ± 1%     7.81k ± 1%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          2.22k ± 1%     2.18k ± 1%   -2.23%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        7.82k ± 4%     7.78k ± 1%     ~     (p=0.151 n=5+5)
_jsonBody-2                   22.4k ± 2%     21.3k ± 1%   -5.11%  (p=0.008 n=5+5)
_jsonBodyValidation-2         19.6k ± 1%     18.8k ± 1%   -4.12%  (p=0.008 n=5+5)
_outputHeaders-2              41.7k ± 2%     40.0k ± 2%   -4.24%  (p=0.008 n=5+5)
_requestResponseMapping-2     22.2k ± 4%     22.1k ± 4%     ~     (p=0.690 n=5+5)
_validation-2                 21.1k ± 4%     20.5k ± 7%     ~     (p=0.421 n=5+5)
_noValidation-2               28.6k ± 2%     27.6k ± 2%   -3.47%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                 37.8k ± 4%     37.9k ± 2%     ~     (p=0.841 n=5+5)
_directGzipHead-2             38.4k ± 1%     37.8k ± 0%   -1.50%  (p=0.016 n=5+4)
_noDirectGzip-2               7.64k ± 1%     7.47k ± 1%   -2.24%  (p=0.008 n=5+5)
_directGzip_decode-2          2.13k ± 2%     2.15k ± 2%     ~     (p=0.286 n=5+5)
_noDirectGzip_decode-2        7.65k ± 1%     7.47k ± 5%   -2.32%  (p=0.032 n=5+5)
_htmlResponse-2               24.8k ± 1%     24.2k ± 2%   -2.28%  (p=0.032 n=5+5)
_jsonBodyManual-2             35.0k ± 1%     33.8k ± 2%   -3.28%  (p=0.008 n=5+5)
_jsonBody-2                   23.9k ± 3%     23.3k ± 2%   -2.29%  (p=0.032 n=5+5)
_jsonBodyValidation-2         18.8k ± 2%     18.3k ± 2%   -2.73%  (p=0.032 n=5+5)
_outputHeaders-2              38.6k ± 2%     37.2k ± 2%   -3.60%  (p=0.008 n=5+5)
_requestResponseMapping-2     22.0k ± 2%     21.1k ± 4%   -3.98%  (p=0.032 n=5+5)
_validation-2                 20.6k ± 1%     19.9k ± 1%   -3.52%  (p=0.008 n=5+5)
_noValidation-2               28.5k ± 3%     27.0k ± 2%   -5.23%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                35.0k ± 8%     35.4k ± 1%     ~     (p=0.421 n=5+5)
_ok-2                         34.7k ± 2%     34.3k ± 1%     ~     (p=0.413 n=5+4)
_invalidBody-2                24.8k ± 1%     24.5k ± 1%   -1.07%  (p=0.032 n=5+5)

name                       old alloc/op   new alloc/op   delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                3.99kB ± 0%    3.99kB ± 0%     ~     (p=0.079 n=5+5)
_directGzipHead-2            3.99kB ± 0%    3.99kB ± 0%     ~     (p=0.135 n=5+5)
_noDirectGzip-2              6.90kB ±16%    6.62kB ±17%     ~     (p=0.690 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%     ~     (p=0.421 n=5+5)
_noDirectGzip_decode-2       6.10kB ± 7%    6.13kB ± 4%     ~     (p=1.000 n=5+5)
_jsonBody-2                  13.2kB ± 0%    13.2kB ± 0%     ~     (p=0.952 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%   +0.03%  (p=0.016 n=5+5)
_outputHeaders-2             3.71kB ± 0%    3.71kB ± 0%     ~     (p=0.603 n=5+5)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.317 n=4+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.175 n=5+5)
_noValidation-2              7.89kB ± 0%    7.89kB ± 0%     ~     (p=0.540 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                4.04kB ± 0%    4.04kB ± 0%     ~     (p=0.968 n=5+4)
_directGzipHead-2            4.04kB ± 0%    4.04kB ± 0%     ~     (p=0.762 n=5+5)
_noDirectGzip-2              7.14kB ±18%    7.05kB ±15%     ~     (p=0.841 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%     ~     (p=0.095 n=5+5)
_noDirectGzip_decode-2       6.26kB ± 4%    5.75kB ± 4%   -8.25%  (p=0.008 n=5+5)
_htmlResponse-2              8.29kB ± 0%    8.29kB ± 0%     ~     (p=0.754 n=5+5)
_jsonBodyManual-2            4.65kB ± 0%    4.65kB ± 0%     ~     (p=0.079 n=4+5)
_jsonBody-2                  10.4kB ± 0%    10.4kB ± 0%     ~     (p=0.619 n=5+5)
_jsonBodyValidation-2        19.1kB ± 0%    19.1kB ± 0%     ~     (p=0.833 n=5+5)
_outputHeaders-2             4.36kB ± 0%    4.36kB ± 0%     ~     (p=0.143 n=5+5)
_requestResponseMapping-2    16.8kB ± 0%    16.8kB ± 0%     ~     (p=0.611 n=5+5)
_validation-2                16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.214 n=5+5)
_noValidation-2              7.95kB ± 0%    7.95kB ± 0%     ~     (p=0.532 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               4.89kB ± 0%    4.89kB ± 0%     ~     (p=0.079 n=5+5)
_ok-2                        4.79kB ± 0%    4.79kB ± 0%     ~     (p=0.343 n=4+4)
_invalidBody-2               8.63kB ± 0%    8.63kB ± 0%     ~     (p=0.886 n=4+4)

name                       old allocs/op  new allocs/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  43.0 ± 0%      43.0 ± 0%     ~     (all equal)
_directGzipHead-2              43.0 ± 0%      43.0 ± 0%     ~     (all equal)
_noDirectGzip-2                50.4 ± 3%      50.6 ± 3%     ~     (p=1.000 n=5+5)
_directGzip_decode-2            503 ± 0%       504 ± 0%     ~     (p=0.444 n=5+5)
_noDirectGzip_decode-2         51.0 ± 0%      51.0 ± 0%     ~     (all equal)
_jsonBody-2                     130 ± 0%       130 ± 0%     ~     (all equal)
_jsonBodyValidation-2           186 ± 0%       186 ± 0%     ~     (all equal)
_outputHeaders-2               37.0 ± 0%      37.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       126 ± 0%       126 ± 0%     ~     (all equal)
_validation-2                   155 ± 0%       155 ± 0%     ~     (all equal)
_noValidation-2                92.0 ± 0%      92.0 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  45.0 ± 0%      45.0 ± 0%     ~     (all equal)
_directGzipHead-2              45.0 ± 0%      45.0 ± 0%     ~     (all equal)
_noDirectGzip-2                52.6 ± 3%      52.8 ± 3%     ~     (p=1.000 n=5+5)
_directGzip_decode-2            504 ± 0%       504 ± 0%     ~     (p=1.000 n=5+5)
_noDirectGzip_decode-2         53.0 ± 0%      53.0 ± 0%     ~     (all equal)
_htmlResponse-2                 146 ± 0%       146 ± 0%     ~     (all equal)
_jsonBodyManual-2              51.0 ± 0%      51.0 ± 0%     ~     (all equal)
_jsonBody-2                     102 ± 0%       102 ± 0%     ~     (all equal)
_jsonBodyValidation-2           188 ± 0%       188 ± 0%     ~     (all equal)
_outputHeaders-2               46.0 ± 0%      46.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       128 ± 0%       128 ± 0%     ~     (all equal)
_validation-2                   157 ± 0%       157 ± 0%     ~     (all equal)
_noValidation-2                94.0 ± 0%      94.0 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 54.0 ± 0%      54.0 ± 0%     ~     (all equal)
_ok-2                          50.0 ± 0%      50.0 ± 0%     ~     (all equal)
_invalidBody-2                 99.0 ± 0%      99.0 ± 0%     ~     (all equal)
```
</details>
<!-- Sticky Pull Request Commentbench-examples -->

Patch:
diff --git a/_examples/go.mod b/_examples/go.mod
index dbb4717..ddb8f65 100644
--- a/_examples/go.mod
+++ b/_examples/go.mod
@@ -17,7 +17,7 @@ require (
 	github.com/swaggest/jsonschema-go v0.3.47
 	github.com/swaggest/openapi-go v0.2.28
 	github.com/swaggest/swgui v1.5.1
-	github.com/swaggest/usecase v1.2.0
+	github.com/swaggest/usecase v1.2.1
 	github.com/valyala/fasthttp v1.44.0
 )
 
diff --git a/_examples/go.sum b/_examples/go.sum
index fc45e11..dff0af1 100644
--- a/_examples/go.sum
+++ b/_examples/go.sum
@@ -70,8 +70,8 @@ github.com/swaggest/refl v1.1.0 h1:a+9a75Kv6ciMozPjVbOfcVTEQe81t2R3emvaD9oGQGc=
 github.com/swaggest/refl v1.1.0/go.mod h1:g3Qa6ki0A/L2yxiuUpT+cuBURuRaltF5SDQpg1kMZSY=
 github.com/swaggest/swgui v1.5.1 h1:CXJ2l9n1nEz2AJXl/FHDGD5ZtlKnTRJb2p86njBfXfo=
 github.com/swaggest/swgui v1.5.1/go.mod h1:lKfAIKTFBStjUtyXz56OQpXgQtpGZAWWIBv4QJtxRQA=
-github.com/swaggest/usecase v1.2.0 h1:cHVFqxIbHfyTXp02JmWXk+ZADaSa87UZP+b3qL5Nz90=
-github.com/swaggest/usecase v1.2.0/go.mod h1:oc5+QoAxG3Et5Gl9lRXgEOm00l4VN9gdVQSMIa5EeLY=
+github.com/swaggest/usecase v1.2.1 h1:XYVdK9tK2KCPglTflUi7aWBrVwIyb58D5mvGWED7pNs=
+github.com/swaggest/usecase v1.2.1/go.mod h1:5ccwVsLJ9eQpU4m0AGTM444pdqSPQBiocIwMmdRH9lQ=
 github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
 github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
 github.com/valyala/fasthttp v1.44.0 h1:R+gLUhldIsfg1HokMuQjdQ5bh9nuXHPIfvkYUu9eR5Q=
diff --git a/go.mod b/go.mod
index 241fa22..ecc6685 100644
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
 	github.com/swaggest/jsonschema-go v0.3.47
 	github.com/swaggest/openapi-go v0.2.28
 	github.com/swaggest/refl v1.1.0
-	github.com/swaggest/usecase v1.2.0
+	github.com/swaggest/usecase v1.2.1
 )
 
 require (
diff --git a/go.sum b/go.sum
index 0360bce..4816bd6 100644
--- a/go.sum
+++ b/go.sum
@@ -2,7 +2,6 @@ github.com/bool64/dev v0.2.5/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zR
 github.com/bool64/dev v0.2.10/go.mod h1:/csLrm+4oDSsKJRIVS0mrywAonLnYKFG8RvGT7Jh9b8=
 github.com/bool64/dev v0.2.16/go.mod h1:/csLrm+4oDSsKJRIVS0mrywAonLnYKFG8RvGT7Jh9b8=
 github.com/bool64/dev v0.2.17/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
-github.com/bool64/dev v0.2.20/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
 github.com/bool64/dev v0.2.22/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
 github.com/bool64/dev v0.2.24 h1:xptlKivPh870W3Xc9szPcM7wkFmTMuHT8rc0nu7dITk=
 github.com/bool64/dev v0.2.24/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
@@ -82,8 +81,8 @@ github.com/swaggest/openapi-go v0.2.28 h1:PRgJTqRfpsWte7qPqMFJooLu8cWyL91FhpYH2k
 github.com/swaggest/openapi-go v0.2.28/go.mod h1:2RAaFLmRFQiR8TQJyIZzh2NTY1ihk3/WxYJFxQ+TfFU=
 github.com/swaggest/refl v1.1.0 h1:a+9a75Kv6ciMozPjVbOfcVTEQe81t2R3emvaD9oGQGc=
 github.com/swaggest/refl v1.1.0/go.mod h1:g3Qa6ki0A/L2yxiuUpT+cuBURuRaltF5SDQpg1kMZSY=
-github.com/swaggest/usecase v1.2.0 h1:cHVFqxIbHfyTXp02JmWXk+ZADaSa87UZP+b3qL5Nz90=
-github.com/swaggest/usecase v1.2.0/go.mod h1:oc5+QoAxG3Et5Gl9lRXgEOm00l4VN9gdVQSMIa5EeLY=
+github.com/swaggest/usecase v1.2.1 h1:XYVdK9tK2KCPglTflUi7aWBrVwIyb58D5mvGWED7pNs=
+github.com/swaggest/usecase v1.2.1/go.mod h1:5ccwVsLJ9eQpU4m0AGTM444pdqSPQBiocIwMmdRH9lQ=
 github.com/yosuke-furukawa/json5 v0.1.2-0.20201207051438-cf7bb3f354ff h1:7YqG491bE4vstXRz1lD38rbSgbXnirvROz1lZiOnPO8=
 github.com/yosuke-furukawa/json5 v0.1.2-0.20201207051438-cf7bb3f354ff/go.mod h1:sw49aWDqNdRJ6DYUtIQiaA3xyj2IL9tjeNYmX2ixwcU=
 github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA=
diff --git a/request/decoder.go b/request/decoder.go
index c24400a..fd14f18 100644
--- a/request/decoder.go
+++ b/request/decoder.go
@@ -18,6 +18,13 @@ type (
 		LoadFromHTTPRequest(r *http.Request) error
 	}
 
+	// Setter captures original http.Request.
+	//
+	// Implement this interface on a pointer to your input structure to get access to http.Request.
+	Setter interface {
+		SetRequest(r *http.Request)
+	}
+
 	decoderFunc      func(r *http.Request) (url.Values, error)
 	valueDecoderFunc func(r *http.Request, v interface{}, validator rest.Validator) error
 )
@@ -66,16 +73,26 @@ func makeDecoder(in rest.ParamIn, formDecoder *form.Decoder, decoderFunc decoder
 
 // decoder extracts Go value from *http.Request.
 type decoder struct {
-	decoders []valueDecoderFunc
-	in       []rest.ParamIn
+	decoders    []valueDecoderFunc
+	in          []rest.ParamIn
+	isReqLoader bool
+	isReqSetter bool
 }
 
 var _ nethttp.RequestDecoder = &decoder{}
 
 // Decode populates and validates input with data from http request.
 func (d *decoder) Decode(r *http.Request, input interface{}, validator rest.Validator) error {
-	if i, ok := input.(Loader); ok {
-		return i.LoadFromHTTPRequest(r)
+	if d.isReqSetter {
+		if i, ok := input.(Setter); ok {
+			i.SetRequest(r)
+		}
+	}
+
+	if d.isReqLoader {
+		if i, ok := input.(Loader); ok {
+			return i.LoadFromHTTPRequest(r)
+		}
 	}
 
 	for i, decode := range d.decoders {
diff --git a/request/factory.go b/request/factory.go
index a739845..c7e4356 100644
--- a/request/factory.go
+++ b/request/factory.go
@@ -96,19 +96,16 @@ func (df *DecoderFactory) MakeDecoder(
 	input interface{},
 	customMapping rest.RequestMapping,
 ) nethttp.RequestDecoder {
-	m := decoder{
-		decoders: make([]valueDecoderFunc, 0),
-		in:       make([]rest.ParamIn, 0),
-	}
+	d := initDecoder(input)
 
 	if df.ApplyDefaults && refl.HasTaggedFields(input, defaultTag) {
-		df.makeDefaultDecoder(input, &m)
+		df.makeDefaultDecoder(input, &d)
 	}
 
 	cm := df.prepareCustomMapping(input, customMapping)
 
 	if len(cm) > 0 {
-		df.makeCustomMappingDecoder(cm, &m)
+		df.makeCustomMappingDecoder(cm, &d)
 	}
 
 	for in, formDecoder := range df.formDecoders {
@@ -118,8 +115,8 @@ func (df *DecoderFactory) MakeDecoder(
 
 		if refl.HasTaggedFields(input, string(in)) {
 			df.jsonParams(formDecoder, in, input)
-			m.decoders = append(m.decoders, makeDecoder(in, formDecoder, df.decoderFunctions[in]))
-			m.in = append(m.in, in)
+			d.decoders = append(d.decoders, makeDecoder(in, formDecoder, df.decoderFunctions[in]))
+			d.in = append(d.in, in)
 		}
 	}
 
@@ -128,7 +125,7 @@ func (df *DecoderFactory) MakeDecoder(
 	_, forceRequestBody := input.(openapi3.RequestBodyEnforcer)
 
 	if method != http.MethodPost && method != http.MethodPut && method != http.MethodPatch && !forceRequestBody {
-		return &m
+		return &d
 	}
 
 	hasFormData := refl.HasTaggedFields(input, formDataTag)
@@ -137,20 +134,37 @@ func (df *DecoderFactory) MakeDecoder(
 	if refl.HasTaggedFields(input, jsonTag) || refl.FindEmbeddedSliceOrMap(input) != nil ||
 		refl.IsSliceOrMap(input) || refl.IsScalar(input) {
 		if df.JSONReader != nil {
-			m.decoders = append(m.decoders, decodeJSONBody(df.JSONReader, hasFormData))
+			d.decoders = append(d.decoders, decodeJSONBody(df.JSONReader, hasFormData))
 		} else {
-			m.decoders = append(m.decoders, decodeJSONBody(readJSON, hasFormData))
+			d.decoders = append(d.decoders, decodeJSONBody(readJSON, hasFormData))
 		}
 
-		m.in = append(m.in, rest.ParamInBody)
+		d.in = append(d.in, rest.ParamInBody)
 	}
 
 	if hasFileFields(input, fileTag) || hasFileFields(input, formDataTag) {
-		m.decoders = append(m.decoders, decodeFiles)
-		m.in = append(m.in, rest.ParamInFormData)
+		d.decoders = append(d.decoders, decodeFiles)
+		d.in = append(d.in, rest.ParamInFormData)
+	}
+
+	return &d
+}
+
+func initDecoder(input interface{}) decoder {
+	d := decoder{
+		decoders: make([]valueDecoderFunc, 0),
+		in:       make([]rest.ParamIn, 0),
+	}
+
+	if _, ok := input.(Loader); ok {
+		d.isReqLoader = true
+	}
+
+	if _, ok := input.(Setter); ok {
+		d.isReqSetter = true
 	}
 
-	return &m
+	return d
 }
 
 func (df *DecoderFactory) prepareCustomMapping(input interface{}, customMapping rest.RequestMapping) rest.RequestMapping {
diff --git a/response/gzip/middleware.go b/response/gzip/middleware.go
index 540f85c..106ce18 100644
--- a/response/gzip/middleware.go
+++ b/response/gzip/middleware.go
@@ -162,6 +162,11 @@ func (rw *gzipResponseWriter) writeHeader(statusCode int) {
 	}
 
 	h := rw.Header()
+	ct := h.Get(contentTypeHeader)
+
+	if ct == "image/jpeg" || ct == "image/png" || ct == "image/webp" || ct == "image/gif" {
+		rw.disableCompression = true
+	}
 
 	if h.Get(contentEncodingHeader) != "" || rw.disableCompression {
 		// The request handler disabled gzip encoding.
@@ -177,7 +182,7 @@ func (rw *gzipResponseWriter) writeHeader(statusCode int) {
 
 		h.Del(contentLengthHeader)
 
-		if h.Get(contentTypeHeader) == "" {
+		if ct == "" {
 			// Disable auto-detection of content-type, since it
 			// is incorrectly detected after the compression.
 			h.Set(contentTypeHeader, "text/html")


Test patch:
diff --git a/request/decoder_test.go b/request/decoder_test.go
index e2e11c1..7e0136f 100644
--- a/request/decoder_test.go
+++ b/request/decoder_test.go
@@ -432,6 +432,17 @@ func (i *inputWithLoader) LoadFromHTTPRequest(r *http.Request) error {
 	return i.load(r)
 }
 
+type inputWithSetter struct {
+	Time time.Time    `query:"time"`
+	Date jschema.Date `query:"date"`
+
+	r *http.Request
+}
+
+func (i *inputWithSetter) SetRequest(r *http.Request) {
+	i.r = r
+}
+
 func TestDecoder_Decode_manualLoader(t *testing.T) {
 	req, err := http.NewRequestWithContext(context.Background(), http.MethodGet,
 		"/?time=2020-04-04T00:00:00Z&date=2020-04-04", nil)
@@ -458,6 +469,23 @@ func TestDecoder_Decode_manualLoader(t *testing.T) {
 	assert.True(t, input.Time.IsZero())
 }
 
+func TestDecoder_Decode_setter(t *testing.T) {
+	req, err := http.NewRequestWithContext(context.Background(), http.MethodGet,
+		"/?time=2020-04-04T00:00:00Z&date=2020-04-04", nil)
+	assert.NoError(t, err)
+
+	input := new(inputWithSetter)
+
+	dec := request.NewDecoderFactory().MakeDecoder(http.MethodGet, input, nil)
+	validator := jsonschema.NewFactory(&openapi.Collector{}, &openapi.Collector{}).
+		MakeRequestValidator(http.MethodGet, input, nil)
+
+	err = dec.Decode(req, input, validator)
+	assert.NoError(t, err, fmt.Sprintf("%v", err))
+	assert.False(t, input.Time.IsZero())
+	assert.NotNil(t, input.r)
+}
+
 func TestDecoder_Decode_unknownParams(t *testing.T) {
 	req, err := http.NewRequestWithContext(context.Background(), http.MethodGet,
 		"/?foo=1&bar=1&bar=2&baz&quux=123", nil)