Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods for NotFound and MethodNotAllowed, add response.EmbeddedSetter #185

Merged
merged 2 commits into from
Jan 1, 2024

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Jan 1, 2024

No description provided.

Copy link

github-actions bot commented Jan 1, 2024

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 112 8566 (+57) 6170 (+35) 648 (+11) 1748 (+11) 1022 (+5) 208.6K (+1.6K)
Go (test) 54 6458 (+87) 4949 (+72) 295 1214 (+15) 188 177.6K (+2.2K)

Copy link

github-actions bot commented Jan 1, 2024

Go API Changes

# github.com/swaggest/rest/chirouter
## compatible changes
(*Wrapper).HandlerFunc: added

# github.com/swaggest/rest/response
## compatible changes
EmbeddedSetter: added
Setter: added

# github.com/swaggest/rest/web
## compatible changes
(*Service).OnMethodNotAllowed: added
(*Service).OnNotFound: added
github.com/swaggest/rest/chirouter.(*Wrapper).HandlerFunc: added

# summary
Inferred base version: v0.2.60
Suggested version: v0.3.0

Copy link

github-actions bot commented Jan 1, 2024

Unit Test Coverage

total: (statements) 81.2%
changed lines: (statements) 100.0%

Coverage of changed lines
File Function Coverage
Total 100.0%
chirouter/wrapper.go 100.0%
chirouter/wrapper.go:205 HandlerFunc 100.0%
request/middleware.go 100.0%
request/middleware.go:20 DecoderMiddleware 100.0%
response/encoder.go 100.0%
response/encoder.go:183 SetupOutput 100.0%
response/encoder.go:499 MakeOutput 100.0%
response/encoder.go:580 SetResponseWriter 100.0%
response/encoder.go:585 ResponseWriter 100.0%
web/service.go 100.0%
web/service.go:166 OnNotFound 100.0%
web/service.go:171 OnMethodNotAllowed 100.0%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 81.0% 81.2% (+0.2%)
chirouter/wrapper.go HandlerFunc no function 100.0%
request/middleware.go DecoderMiddleware 93.3% 94.1% (+0.8%)
response/encoder.go MakeOutput 77.8% 83.3% (+5.5%)
response/encoder.go ResponseWriter no function 100.0%
response/encoder.go SetResponseWriter no function 100.0%
response/encoder.go SetupOutput 84.0% 85.2% (+1.2%)
web/service.go OnMethodNotAllowed no function 100.0%
web/service.go OnNotFound no function 100.0%

Copy link

codecov bot commented Jan 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d64d866) 76.00% compared to head (337a87e) 76.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
+ Coverage   76.00%   76.16%   +0.16%     
==========================================
  Files          30       30              
  Lines        1700     1712      +12     
==========================================
+ Hits         1292     1304      +12     
  Misses        295      295              
  Partials      113      113              
Flag Coverage Δ
unittests 76.16% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jan 1, 2024

Benchmark Result

Benchmark diff with base branch
Module github.com/bool64/dev not found, downloading.
name                                    old time/op    new time/op    delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-4    1.11µs ± 3%    1.09µs ± 0%  -1.68%  (p=0.004 n=6+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-4                           510ns ± 0%     515ns ± 1%  +1.06%  (p=0.004 n=6+5)
DecoderFunc_Decode-4                      1.50µs ± 0%    1.49µs ± 2%    ~     (p=0.909 n=6+6)
Decoder_Decode_json-4                     18.4µs ± 0%    18.2µs ± 1%  -0.96%  (p=0.004 n=5+6)
Decoder_Decode_queryObject-4              3.91µs ± 0%    3.97µs ± 0%  +1.48%  (p=0.004 n=6+5)
Decoder_Decode_jsonParam-4                1.50µs ± 0%    1.50µs ± 0%    ~     (p=0.234 n=5+6)
DecoderFactory_SetDecoderFunc-4           1.31µs ± 1%    1.31µs ± 0%    ~     (p=0.292 n=6+6)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-4                              11.5µs ± 4%    11.4µs ± 0%    ~     (p=1.000 n=6+5)
Middleware_control-4                      2.61µs ± 4%    2.58µs ± 1%    ~     (p=0.102 n=6+6)

name                                    old alloc/op   new alloc/op   delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-4    2.46kB ± 0%    2.46kB ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-4                            440B ± 0%      440B ± 0%    ~     (all equal)
DecoderFunc_Decode-4                      1.51kB ± 0%    1.51kB ± 0%    ~     (all equal)
Decoder_Decode_json-4                     12.2kB ± 0%    12.2kB ± 0%    ~     (all equal)
Decoder_Decode_queryObject-4              2.00kB ± 0%    2.00kB ± 0%    ~     (all equal)
Decoder_Decode_jsonParam-4                  736B ± 0%      736B ± 0%    ~     (all equal)
DecoderFactory_SetDecoderFunc-4           1.02kB ± 0%    1.02kB ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-4                              1.22kB ± 8%    1.24kB ± 4%    ~     (p=0.513 n=6+6)
Middleware_control-4                      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-4      8.00 ± 0%      8.00 ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-4                            4.00 ± 0%      4.00 ± 0%    ~     (all equal)
DecoderFunc_Decode-4                        12.0 ± 0%      12.0 ± 0%    ~     (all equal)
Decoder_Decode_json-4                        177 ± 0%       177 ± 0%    ~     (all equal)
Decoder_Decode_queryObject-4                36.0 ± 0%      36.0 ± 0%    ~     (all equal)
Decoder_Decode_jsonParam-4                  13.0 ± 0%      13.0 ± 0%    ~     (all equal)
DecoderFactory_SetDecoderFunc-4             16.0 ± 0%      16.0 ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-4                                11.0 ± 0%      11.0 ± 0%    ~     (all equal)
Middleware_control-4                        9.00 ± 0%      9.00 ± 0%    ~     (all equal)
Benchmark result
name                                    time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-4  1.09µs ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-4                         515ns ± 1%
DecoderFunc_Decode-4                    1.49µs ± 2%
Decoder_Decode_json-4                   18.2µs ± 1%
Decoder_Decode_queryObject-4            3.97µs ± 0%
Decoder_Decode_jsonParam-4              1.50µs ± 0%
DecoderFactory_SetDecoderFunc-4         1.31µs ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-4                            11.4µs ± 0%
Middleware_control-4                    2.58µs ± 1%

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

name                                    allocs/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-4    8.00 ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-4                          4.00 ± 0%
DecoderFunc_Decode-4                      12.0 ± 0%
Decoder_Decode_json-4                      177 ± 0%
Decoder_Decode_queryObject-4              36.0 ± 0%
Decoder_Decode_jsonParam-4                13.0 ± 0%
DecoderFactory_SetDecoderFunc-4           16.0 ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-4                              11.0 ± 0%
Middleware_control-4                      9.00 ± 0%

Copy link

github-actions bot commented Jan 1, 2024

Examples Benchmark Result

Benchmark diff with base branch
name                       old time/op    new time/op    delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-4                16.1µs ± 2%    16.2µs ± 1%     ~     (p=0.556 n=5+4)
_directGzipHead-4            15.9µs ± 1%    16.1µs ± 0%   +1.54%  (p=0.008 n=5+5)
_noDirectGzip-4               103µs ± 2%     102µs ± 1%     ~     (p=0.548 n=5+5)
_directGzip_decode-4          341µs ± 4%     338µs ± 1%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-4        103µs ± 1%     103µs ± 1%     ~     (p=0.421 n=5+5)
_jsonBody-4                  33.6µs ± 1%    34.1µs ± 1%   +1.34%  (p=0.016 n=5+5)
_jsonBodyValidation-4        39.6µs ± 3%    38.9µs ± 1%     ~     (p=0.310 n=5+5)
_outputHeaders-4             16.4µs ± 1%    16.7µs ± 1%   +1.81%  (p=0.008 n=5+5)
_requestResponseMapping-4    33.3µs ± 1%    33.4µs ± 0%     ~     (p=0.222 n=5+5)
_validation-4                35.8µs ± 1%    35.9µs ± 1%     ~     (p=0.421 n=5+5)
_noValidation-4              25.4µs ± 1%    25.5µs ± 2%     ~     (p=0.841 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                16.1µs ± 0%    16.4µs ± 2%   +1.48%  (p=0.032 n=5+5)
_directGzipHead-4            16.4µs ± 9%    16.1µs ± 0%     ~     (p=0.730 n=5+4)
_noDirectGzip-4              91.8µs ± 0%    91.8µs ± 1%     ~     (p=0.421 n=5+5)
_directGzip_decode-4          322µs ± 2%     321µs ± 1%     ~     (p=0.841 n=5+5)
_noDirectGzip_decode-4       92.0µs ± 1%    92.4µs ± 2%     ~     (p=0.841 n=5+5)
_htmlResponse-4              28.8µs ± 0%    29.6µs ± 5%   +2.56%  (p=0.008 n=5+5)
_jsonBodyManual-4            20.5µs ± 1%    20.7µs ± 1%   +1.26%  (p=0.008 n=5+5)
_jsonBody-4                  30.2µs ± 1%    30.4µs ± 1%     ~     (p=0.095 n=5+5)
_jsonBodyValidation-4        38.9µs ± 1%    39.5µs ± 1%   +1.46%  (p=0.032 n=5+5)
_outputHeaders-4             28.1µs ± 1%    28.7µs ± 1%   +2.10%  (p=0.008 n=5+5)
_requestResponseMapping-4    33.1µs ± 1%    33.9µs ± 1%   +2.16%  (p=0.008 n=5+5)
_validation-4                35.3µs ± 0%    36.2µs ± 1%   +2.40%  (p=0.008 n=5+5)
_noValidation-4              25.3µs ± 2%    25.9µs ± 2%   +2.36%  (p=0.032 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4               18.3µs ± 2%    18.9µs ± 9%     ~     (p=0.095 n=5+5)
_ok-4                        18.2µs ± 1%    18.6µs ± 1%   +1.69%  (p=0.016 n=5+5)
_invalidBody-4               26.3µs ± 4%    27.0µs ± 4%     ~     (p=0.095 n=5+5)

name                       old 50%:ms     new 50%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-4                  0.73 ± 7%      0.73 ±11%     ~     (p=0.690 n=5+5)
_directGzipHead-4              0.69 ± 6%      0.70 ± 3%     ~     (p=0.548 n=5+5)
_noDirectGzip-4                4.71 ± 6%      4.72 ± 5%     ~     (p=1.000 n=5+5)
_directGzip_decode-4           12.1 ± 8%      12.4 ± 8%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-4         4.70 ± 6%      4.73 ± 4%     ~     (p=1.000 n=5+5)
_jsonBody-4                    1.41 ± 6%      1.43 ± 5%     ~     (p=0.635 n=5+5)
_jsonBodyValidation-4          1.64 ± 6%      1.58 ± 6%     ~     (p=0.151 n=5+5)
_outputHeaders-4               0.74 ± 5%      0.75 ± 9%     ~     (p=1.000 n=5+5)
_requestResponseMapping-4      1.36 ± 7%      1.34 ± 6%     ~     (p=0.841 n=5+5)
_validation-4                  1.42 ± 4%      1.48 ± 7%     ~     (p=0.310 n=5+5)
_noValidation-4                1.07 ± 5%      1.06 ±11%     ~     (p=0.802 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                  0.72 ± 7%      0.77 ± 5%   +7.73%  (p=0.016 n=5+5)
_directGzipHead-4              0.72 ± 7%      0.70 ± 7%     ~     (p=0.548 n=5+5)
_noDirectGzip-4                4.20 ± 5%      4.22 ± 2%     ~     (p=1.000 n=5+5)
_directGzip_decode-4           11.5 ± 4%      11.6 ± 5%     ~     (p=0.952 n=5+5)
_noDirectGzip_decode-4         4.20 ± 4%      4.17 ± 4%     ~     (p=0.841 n=5+5)
_htmlResponse-4                1.20 ± 3%      1.22 ± 3%     ~     (p=0.310 n=5+5)
_jsonBodyManual-4              0.90 ± 5%      0.91 ± 5%     ~     (p=0.651 n=5+5)
_jsonBody-4                    1.26 ± 7%      1.31 ± 5%     ~     (p=0.310 n=5+5)
_jsonBodyValidation-4          1.59 ± 2%      1.59 ± 4%     ~     (p=0.690 n=5+5)
_outputHeaders-4               1.14 ± 7%      1.20 ± 4%     ~     (p=0.056 n=5+5)
_requestResponseMapping-4      1.31 ± 3%      1.33 ± 3%     ~     (p=0.167 n=5+5)
_validation-4                  1.46 ± 5%      1.50 ± 7%     ~     (p=0.548 n=5+5)
_noValidation-4                1.12 ± 5%      1.08 ± 6%     ~     (p=0.222 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                 0.84 ± 4%      0.83 ± 8%     ~     (p=0.548 n=5+5)
_ok-4                          0.82 ± 5%      0.79 ± 4%     ~     (p=0.222 n=5+5)
_invalidBody-4                 1.09 ± 6%      1.11 ± 8%     ~     (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-4                  1.43 ± 5%      1.49 ± 9%     ~     (p=0.421 n=5+5)
_directGzipHead-4              1.42 ± 2%      1.46 ± 4%     ~     (p=0.151 n=5+5)
_noDirectGzip-4                9.76 ± 5%      9.77 ± 3%     ~     (p=0.690 n=5+5)
_directGzip_decode-4           32.7 ±11%      31.7 ± 8%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-4         10.0 ± 2%       9.8 ± 3%     ~     (p=0.548 n=5+5)
_jsonBody-4                    3.10 ± 3%      3.15 ± 5%     ~     (p=0.421 n=5+5)
_jsonBodyValidation-4          3.66 ± 4%      3.50 ± 3%     ~     (p=0.056 n=5+5)
_outputHeaders-4               1.47 ± 6%      1.52 ± 5%     ~     (p=0.222 n=5+5)
_requestResponseMapping-4      3.10 ± 2%      3.18 ± 5%     ~     (p=0.151 n=5+5)
_validation-4                  3.38 ± 4%      3.32 ± 3%     ~     (p=0.341 n=5+5)
_noValidation-4                2.37 ± 8%      2.30 ± 5%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                  1.44 ± 4%      1.44 ± 4%     ~     (p=1.000 n=5+5)
_directGzipHead-4              1.47 ± 9%      1.46 ± 6%     ~     (p=0.841 n=5+5)
_noDirectGzip-4                8.81 ± 2%      8.70 ± 4%     ~     (p=0.460 n=5+5)
_directGzip_decode-4           30.8 ± 4%      30.5 ± 2%     ~     (p=1.000 n=5+5)
_noDirectGzip_decode-4         8.88 ± 5%      8.79 ± 5%     ~     (p=1.000 n=5+5)
_htmlResponse-4                2.76 ± 6%      2.79 ± 5%     ~     (p=0.690 n=5+5)
_jsonBodyManual-4              1.85 ± 9%      1.83 ± 2%     ~     (p=1.000 n=5+5)
_jsonBody-4                    2.73 ± 2%      2.80 ± 4%     ~     (p=0.095 n=5+5)
_jsonBodyValidation-4          3.62 ± 7%      3.67 ± 4%     ~     (p=0.690 n=5+5)
_outputHeaders-4               2.66 ± 4%      2.70 ± 3%     ~     (p=0.690 n=5+5)
_requestResponseMapping-4      3.07 ± 3%      3.18 ± 4%     ~     (p=0.095 n=5+5)
_validation-4                  3.30 ± 6%      3.37 ± 3%     ~     (p=0.222 n=5+5)
_noValidation-4                2.39 ± 6%      2.37 ± 2%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                 1.63 ± 3%      1.73 ± 9%     ~     (p=0.063 n=5+5)
_ok-4                          1.66 ± 4%      1.65 ± 4%     ~     (p=0.548 n=5+5)
_invalidBody-4                 2.50 ± 8%      2.54 ± 7%     ~     (p=0.937 n=5+5)

name                       old 99%:ms     new 99%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-4                  2.38 ± 5%      2.54 ±22%     ~     (p=0.690 n=5+5)
_directGzipHead-4              2.39 ± 3%      2.39 ± 2%     ~     (p=0.841 n=5+5)
_noDirectGzip-4                15.2 ± 8%      14.4 ± 4%     ~     (p=0.421 n=5+5)
_directGzip_decode-4           65.1 ±18%      57.4 ± 9%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-4         14.8 ± 6%      14.9 ± 5%     ~     (p=0.889 n=5+5)
_jsonBody-4                    5.02 ± 6%      5.22 ± 5%     ~     (p=0.310 n=5+5)
_jsonBodyValidation-4          6.12 ± 9%      6.09 ± 6%     ~     (p=1.000 n=5+5)
_outputHeaders-4               2.50 ± 4%      2.58 ± 8%     ~     (p=0.690 n=5+5)
_requestResponseMapping-4      5.57 ± 9%      5.59 ± 7%     ~     (p=0.841 n=5+5)
_validation-4                  5.67 ± 8%      6.14 ±11%     ~     (p=0.087 n=5+5)
_noValidation-4                4.36 ± 5%      4.47 ± 9%     ~     (p=0.310 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                  2.38 ± 5%      2.48 ± 8%     ~     (p=0.175 n=5+5)
_directGzipHead-4              2.55 ±15%      2.48 ± 9%     ~     (p=0.841 n=5+5)
_noDirectGzip-4                13.3 ± 4%      13.1 ± 4%     ~     (p=0.333 n=5+5)
_directGzip_decode-4           57.2 ± 5%      57.8 ± 6%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-4         13.1 ±10%      13.2 ± 9%     ~     (p=0.881 n=5+5)
_htmlResponse-4                4.69 ± 6%      4.91 ±21%     ~     (p=0.690 n=5+5)
_jsonBodyManual-4              3.14 ± 1%      3.22 ±10%     ~     (p=1.000 n=5+5)
_jsonBody-4                    4.91 ± 8%      4.99 ±10%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-4          6.48 ±10%      6.27 ±10%     ~     (p=1.000 n=5+5)
_outputHeaders-4               4.76 ± 6%      4.63 ± 3%     ~     (p=0.690 n=5+5)
_requestResponseMapping-4      5.41 ±15%      5.38 ± 5%     ~     (p=1.000 n=5+5)
_validation-4                  5.63 ± 5%      5.45 ± 6%     ~     (p=0.222 n=5+5)
_noValidation-4                4.08 ±12%      4.20 ± 6%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                 2.62 ± 3%      2.92 ±25%  +11.26%  (p=0.016 n=5+5)
_ok-4                          2.69 ± 0%      2.82 ±11%     ~     (p=0.730 n=4+5)
_invalidBody-4                 4.40 ± 6%      4.88 ±11%     ~     (p=0.056 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-4                  4.08 ±23%      4.33 ± 4%     ~     (p=0.730 n=5+4)
_directGzipHead-4              4.19 ±33%      4.26 ±15%     ~     (p=0.841 n=5+5)
_noDirectGzip-4                21.1 ±13%      19.2 ± 6%     ~     (p=0.151 n=5+5)
_directGzip_decode-4           92.6 ±19%      74.7 ± 7%     ~     (p=0.056 n=5+5)
_noDirectGzip_decode-4         19.5 ± 8%      19.4 ± 7%     ~     (p=0.841 n=5+5)
_jsonBody-4                    7.42 ±12%      8.41 ±17%     ~     (p=0.095 n=5+5)
_jsonBodyValidation-4          9.09 ±16%      9.31 ± 8%     ~     (p=0.841 n=5+5)
_outputHeaders-4               5.13 ±18%      5.35 ±20%     ~     (p=0.841 n=5+5)
_requestResponseMapping-4      8.44 ± 4%      9.48 ± 5%  +12.28%  (p=0.008 n=5+5)
_validation-4                  9.31 ± 7%      9.57 ±20%     ~     (p=1.000 n=5+5)
_noValidation-4                8.47 ±27%      7.59 ±22%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                  3.98 ±21%      4.61 ±42%     ~     (p=0.421 n=5+5)
_directGzipHead-4              6.04 ±79%      4.66 ±31%     ~     (p=0.421 n=5+5)
_noDirectGzip-4                18.9 ±25%      16.9 ± 9%     ~     (p=0.151 n=5+5)
_directGzip_decode-4           79.2 ±11%      78.5 ± 8%     ~     (p=1.000 n=5+5)
_noDirectGzip_decode-4         17.8 ±16%      16.6 ± 0%     ~     (p=0.413 n=5+4)
_htmlResponse-4                7.75 ±10%      9.17 ±44%     ~     (p=0.841 n=5+5)
_jsonBodyManual-4              6.05 ± 1%      5.38 ±25%     ~     (p=0.730 n=4+5)
_jsonBody-4                    8.67 ±15%      8.48 ±28%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-4          10.2 ± 7%       9.3 ± 9%     ~     (p=0.151 n=5+5)
_outputHeaders-4               8.40 ±19%      7.48 ±22%     ~     (p=0.222 n=5+5)
_requestResponseMapping-4      9.07 ±29%      8.92 ± 8%     ~     (p=0.841 n=5+5)
_validation-4                  8.95 ± 7%      8.42 ±16%     ~     (p=0.421 n=5+5)
_noValidation-4                6.61 ±26%      6.68 ±23%     ~     (p=0.881 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                 3.98 ±16%      6.12 ±71%  +53.61%  (p=0.032 n=5+5)
_ok-4                          4.69 ±15%      5.41 ±28%     ~     (p=0.421 n=5+5)
_invalidBody-4                 6.71 ±11%      7.57 ±17%     ~     (p=0.151 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-4                   630 ± 0%       630 ± 0%     ~     (all equal)
_directGzipHead-4               174 ± 0%       174 ± 0%     ~     (all equal)
_noDirectGzip-4               1.03k ± 0%     1.03k ± 0%     ~     (all equal)
_directGzip_decode-4            630 ± 0%       630 ± 0%     ~     (all equal)
_noDirectGzip_decode-4        1.03k ± 0%     1.03k ± 0%     ~     (all equal)
_jsonBody-4                     199 ± 0%       199 ± 0%     ~     (all equal)
_jsonBodyValidation-4           185 ± 0%       185 ± 0%     ~     (all equal)
_outputHeaders-4                146 ± 0%       146 ± 0%     ~     (all equal)
_requestResponseMapping-4      94.0 ± 0%      94.0 ± 0%     ~     (all equal)
_validation-4                   168 ± 0%       168 ± 0%     ~     (all equal)
_noValidation-4                 168 ± 0%       168 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                   638 ± 0%       638 ± 0%     ~     (all equal)
_directGzipHead-4               182 ± 0%       182 ± 0%     ~     (all equal)
_noDirectGzip-4               1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_directGzip_decode-4            638 ± 0%       638 ± 0%     ~     (all equal)
_noDirectGzip_decode-4        1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_htmlResponse-4                 355 ± 0%       355 ± 0%     ~     (all equal)
_jsonBodyManual-4               207 ± 0%       207 ± 0%     ~     (all equal)
_jsonBody-4                     207 ± 0%       207 ± 0%     ~     (all equal)
_jsonBodyValidation-4           193 ± 0%       193 ± 0%     ~     (all equal)
_outputHeaders-4                214 ± 0%       214 ± 0%     ~     (all equal)
_requestResponseMapping-4       108 ± 0%       108 ± 0%     ~     (all equal)
_validation-4                   176 ± 0%       176 ± 0%     ~     (all equal)
_noValidation-4                 176 ± 0%       176 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                  322 ± 0%       322 ± 0%     ~     (all equal)
_ok-4                           344 ± 0%       344 ± 0%     ~     (all equal)
_invalidBody-4                  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-4                   103 ± 0%       103 ± 0%     ~     (all equal)
_directGzipHead-4               104 ± 0%       104 ± 0%     ~     (all equal)
_noDirectGzip-4                 117 ± 0%       117 ± 0%     ~     (all equal)
_directGzip_decode-4            116 ± 0%       116 ± 0%     ~     (all equal)
_noDirectGzip_decode-4          130 ± 0%       130 ± 0%     ~     (all equal)
_jsonBody-4                     188 ± 0%       188 ± 0%     ~     (all equal)
_jsonBodyValidation-4           192 ± 0%       192 ± 0%     ~     (all equal)
_outputHeaders-4               77.0 ± 0%      77.0 ± 0%     ~     (all equal)
_requestResponseMapping-4       169 ± 0%       169 ± 0%     ~     (all equal)
_validation-4                   170 ± 0%       170 ± 0%     ~     (all equal)
_noValidation-4                 173 ± 0%       173 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                   103 ± 0%       103 ± 0%     ~     (all equal)
_directGzipHead-4               104 ± 0%       104 ± 0%     ~     (all equal)
_noDirectGzip-4                 117 ± 0%       117 ± 0%     ~     (all equal)
_directGzip_decode-4            116 ± 0%       116 ± 0%     ~     (all equal)
_noDirectGzip_decode-4          130 ± 0%       130 ± 0%     ~     (all equal)
_htmlResponse-4                 108 ± 0%       108 ± 0%     ~     (all equal)
_jsonBodyManual-4               195 ± 0%       195 ± 0%     ~     (all equal)
_jsonBody-4                     188 ± 0%       188 ± 0%     ~     (all equal)
_jsonBodyValidation-4           192 ± 0%       192 ± 0%     ~     (all equal)
_outputHeaders-4               88.0 ± 0%      88.0 ± 0%     ~     (all equal)
_requestResponseMapping-4       169 ± 0%       169 ± 0%     ~     (all equal)
_validation-4                   170 ± 0%       170 ± 0%     ~     (all equal)
_noValidation-4                 173 ± 0%       173 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                 74.0 ± 0%      74.0 ± 0%     ~     (all equal)
_ok-4                          74.0 ± 0%      74.0 ± 0%     ~     (all equal)
_invalidBody-4                  137 ± 0%       137 ± 0%     ~     (all equal)

name                       old rps        new rps        delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-4                 62.0k ± 2%     61.7k ± 1%     ~     (p=0.556 n=5+4)
_directGzipHead-4             63.0k ± 1%     62.0k ± 0%   -1.53%  (p=0.008 n=5+5)
_noDirectGzip-4               9.72k ± 2%     9.76k ± 1%     ~     (p=0.548 n=5+5)
_directGzip_decode-4          2.93k ± 3%     2.96k ± 1%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-4        9.75k ± 1%     9.72k ± 1%     ~     (p=0.421 n=5+5)
_jsonBody-4                   29.7k ± 1%     29.4k ± 1%   -1.33%  (p=0.016 n=5+5)
_jsonBodyValidation-4         25.2k ± 3%     25.7k ± 1%     ~     (p=0.310 n=5+5)
_outputHeaders-4              60.8k ± 1%     59.8k ± 1%   -1.78%  (p=0.008 n=5+5)
_requestResponseMapping-4     30.0k ± 1%     29.9k ± 0%     ~     (p=0.222 n=5+5)
_validation-4                 28.0k ± 1%     27.8k ± 1%     ~     (p=0.421 n=5+5)
_noValidation-4               39.4k ± 1%     39.2k ± 2%     ~     (p=0.841 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                 62.0k ± 0%     61.1k ± 2%   -1.44%  (p=0.032 n=5+5)
_directGzipHead-4             61.1k ± 8%     62.0k ± 0%     ~     (p=0.730 n=5+4)
_noDirectGzip-4               10.9k ± 0%     10.9k ± 1%     ~     (p=0.444 n=5+5)
_directGzip_decode-4          3.10k ± 2%     3.12k ± 1%     ~     (p=0.730 n=5+5)
_noDirectGzip_decode-4        10.9k ± 1%     10.8k ± 2%     ~     (p=0.841 n=5+5)
_htmlResponse-4               34.7k ± 0%     33.8k ± 5%   -2.44%  (p=0.008 n=5+5)
_jsonBodyManual-4             48.9k ± 1%     48.3k ± 1%   -1.25%  (p=0.008 n=5+5)
_jsonBody-4                   33.1k ± 1%     32.9k ± 1%     ~     (p=0.095 n=5+5)
_jsonBodyValidation-4         25.7k ± 1%     25.3k ± 1%   -1.43%  (p=0.032 n=5+5)
_outputHeaders-4              35.5k ± 1%     34.8k ± 1%   -2.06%  (p=0.008 n=5+5)
_requestResponseMapping-4     30.2k ± 1%     29.5k ± 1%   -2.11%  (p=0.008 n=5+5)
_validation-4                 28.3k ± 0%     27.6k ± 1%   -2.34%  (p=0.008 n=5+5)
_noValidation-4               39.5k ± 2%     38.6k ± 2%   -2.31%  (p=0.032 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                54.6k ± 2%     52.9k ± 9%     ~     (p=0.095 n=5+5)
_ok-4                         54.8k ± 1%     53.9k ± 1%   -1.66%  (p=0.016 n=5+5)
_invalidBody-4                38.1k ± 4%     37.0k ± 4%     ~     (p=0.095 n=5+5)

name                       old alloc/op   new alloc/op   delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-4                3.86kB ± 0%    3.86kB ± 0%     ~     (p=0.587 n=5+5)
_directGzipHead-4            3.85kB ± 0%    3.85kB ± 0%     ~     (p=0.722 n=5+5)
_noDirectGzip-4              6.93kB ±22%    6.52kB ±20%     ~     (p=0.841 n=5+5)
_directGzip_decode-4          404kB ± 0%     404kB ± 0%     ~     (p=0.143 n=5+5)
_noDirectGzip_decode-4       5.83kB ± 6%    5.80kB ± 8%     ~     (p=0.841 n=5+5)
_jsonBody-4                  13.1kB ± 0%    13.2kB ± 0%   +0.08%  (p=0.048 n=5+5)
_jsonBodyValidation-4        19.0kB ± 0%    19.0kB ± 0%     ~     (p=0.397 n=5+5)
_outputHeaders-4             3.57kB ± 0%    3.57kB ± 0%     ~     (p=0.905 n=5+5)
_requestResponseMapping-4    16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.310 n=5+5)
_validation-4                16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.540 n=5+5)
_noValidation-4              7.78kB ± 0%    7.78kB ± 0%     ~     (p=0.897 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                3.88kB ± 0%    3.89kB ± 0%     ~     (p=0.397 n=5+5)
_directGzipHead-4            3.88kB ± 0%    3.88kB ± 0%     ~     (p=0.810 n=5+5)
_noDirectGzip-4              6.76kB ±18%    7.07kB ±26%     ~     (p=0.690 n=5+5)
_directGzip_decode-4          404kB ± 0%     404kB ± 0%     ~     (p=0.421 n=5+5)
_noDirectGzip_decode-4       6.10kB ± 6%    5.96kB ± 8%     ~     (p=0.690 n=5+5)
_htmlResponse-4              8.08kB ± 0%    8.08kB ± 0%     ~     (p=0.325 n=5+5)
_jsonBodyManual-4            4.50kB ± 0%    4.50kB ± 0%     ~     (p=1.000 n=4+5)
_jsonBody-4                  10.3kB ± 0%    10.3kB ± 0%     ~     (p=0.143 n=5+5)
_jsonBodyValidation-4        19.1kB ± 0%    19.1kB ± 0%   -0.06%  (p=0.048 n=5+5)
_outputHeaders-4             10.4kB ± 0%    10.4kB ± 0%     ~     (p=0.341 n=5+5)
_requestResponseMapping-4    16.7kB ± 0%    16.7kB ± 0%     ~     (p=1.000 n=5+5)
_validation-4                16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.738 n=5+5)
_noValidation-4              7.84kB ± 0%    7.83kB ± 0%     ~     (p=0.595 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4               4.65kB ± 0%    4.65kB ± 0%     ~     (p=0.611 n=5+5)
_ok-4                        4.55kB ± 0%    4.56kB ± 0%     ~     (p=0.400 n=4+4)
_invalidBody-4               8.27kB ± 0%    8.27kB ± 0%     ~     (p=0.543 n=4+4)

name                       old allocs/op  new allocs/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-4                  42.0 ± 0%      42.0 ± 0%     ~     (all equal)
_directGzipHead-4              42.0 ± 0%      42.0 ± 0%     ~     (all equal)
_noDirectGzip-4                49.2 ± 4%      49.2 ± 4%     ~     (p=1.000 n=5+5)
_directGzip_decode-4            502 ± 0%       503 ± 0%     ~     (p=0.079 n=5+5)
_noDirectGzip_decode-4         50.0 ± 0%      50.0 ± 0%     ~     (all equal)
_jsonBody-4                     128 ± 0%       128 ± 0%     ~     (all equal)
_jsonBodyValidation-4           186 ± 0%       186 ± 0%     ~     (all equal)
_outputHeaders-4               36.0 ± 0%      36.0 ± 0%     ~     (all equal)
_requestResponseMapping-4       124 ± 0%       124 ± 0%     ~     (all equal)
_validation-4                   154 ± 0%       155 ± 0%     ~     (p=0.238 n=5+4)
_noValidation-4                91.0 ± 0%      91.0 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic-openapi31 goos:linux goarch:amd64
_directGzip-4                  44.0 ± 0%      44.0 ± 0%     ~     (all equal)
_directGzipHead-4              44.0 ± 0%      44.0 ± 0%     ~     (all equal)
_noDirectGzip-4                51.2 ± 4%      51.2 ± 4%     ~     (p=1.000 n=5+5)
_directGzip_decode-4            505 ± 0%       505 ± 0%     ~     (p=1.000 n=5+5)
_noDirectGzip_decode-4         52.0 ± 0%      52.0 ± 0%     ~     (all equal)
_htmlResponse-4                 145 ± 0%       145 ± 0%     ~     (all equal)
_jsonBodyManual-4              49.0 ± 0%      49.0 ± 0%     ~     (all equal)
_jsonBody-4                     100 ± 0%       100 ± 0%     ~     (all equal)
_jsonBodyValidation-4           188 ± 0%       188 ± 0%     ~     (all equal)
_outputHeaders-4                113 ± 0%       113 ± 0%     ~     (all equal)
_requestResponseMapping-4       126 ± 0%       126 ± 0%     ~     (all equal)
_validation-4                   156 ± 0%       156 ± 0%     ~     (all equal)
_noValidation-4                93.0 ± 0%      93.0 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-4                 53.0 ± 0%      53.0 ± 0%     ~     (all equal)
_ok-4                          49.0 ± 0%      49.0 ± 0%     ~     (all equal)
_invalidBody-4                 97.0 ± 0%      97.0 ± 0%     ~     (all equal)

@vearutop vearutop changed the title Add methods for NotFound and MethodNotAllowed Add methods for NotFound and MethodNotAllowed, add response.EmbeddedSetter Jan 1, 2024
@vearutop vearutop merged commit 2ccfa52 into master Jan 1, 2024
11 checks passed
@vearutop vearutop deleted the not-found branch January 1, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant