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

Use custom error handler in response errors #117

Merged
merged 3 commits into from
Jan 16, 2023
Merged

Use custom error handler in response errors #117

merged 3 commits into from
Jan 16, 2023

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Jan 16, 2023

Fixes #112.

@github-actions
Copy link

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 104 7193 (+7) 5220 (+6) 482 1491 (+1) 870 (+3) 173.8K (+190B)
Go (test) 47 5065 (+84) 3877 (+68) 185 (+3) 1003 (+13) 178 141.3K (+3K)
Markdown 6 543 414 0 129 0 18.1K (+3B)
YAML 10 731 (+9) 626 46 59 (+9) 0 23K (+339B)

@github-actions
Copy link

Unit Test Coverage

total: (statements) 83.9%
changed lines: (statements) 63.6%, coverage is less than 90.0%, consider testing the changes more thoroughly

Coverage of changed lines
File Function Coverage
Total 63.6%
response/encoder.go 63.6%
response/encoder.go:136 writeJSONResponse 100.0%
response/encoder.go:275 writeError 66.7%
response/encoder.go:285 whiteHeader 50.0%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 83.9% 83.9% (0.0%)
github.com/swaggest/rest/response/encoder.go whiteHeader 83.3% 87.5% (+4.2%)
github.com/swaggest/rest/response/encoder.go writeError no function 60.0%
github.com/swaggest/rest/response/encoder.go writeJSONResponse 64.5% 63.3% (-1.2%)

@github-actions
Copy link

Go API Changes

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

@github-actions
Copy link

Benchmark Result

Benchmark diff with base branch
name                                    old time/op    new time/op    delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    1.69µs ± 2%    1.72µs ± 2%    ~     (p=0.056 n=5+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                           875ns ± 0%     885ns ± 1%  +1.06%  (p=0.004 n=5+6)
DecoderFunc_Decode-2                      2.48µs ± 0%    2.51µs ± 1%  +1.26%  (p=0.010 n=4+6)
Decoder_Decode_json-2                     27.3µs ± 1%    27.5µs ± 1%    ~     (p=0.329 n=5+6)
Decoder_Decode_queryObject-2              5.83µs ± 0%    5.85µs ± 1%    ~     (p=0.571 n=5+6)
Decoder_Decode_jsonParam-2                2.20µs ± 1%    2.21µs ± 1%    ~     (p=0.459 n=5+6)
DecoderFactory_SetDecoderFunc-2           2.06µs ± 1%    2.08µs ± 1%  +0.57%  (p=0.035 n=5+6)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              13.9µs ± 1%    14.0µs ± 0%  +1.01%  (p=0.032 n=5+5)
Middleware_control-2                      4.28µs ± 4%    4.31µs ± 2%    ~     (p=0.662 n=5+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 ± 2%    1.18kB ± 6%    ~     (p=0.706 n=5+6)
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)
Benchmark result
name                                    time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  1.72µs ± 2%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                         885ns ± 1%
DecoderFunc_Decode-2                    2.51µs ± 1%
Decoder_Decode_json-2                   27.5µs ± 1%
Decoder_Decode_queryObject-2            5.85µs ± 1%
Decoder_Decode_jsonParam-2              2.21µs ± 1%
DecoderFactory_SetDecoderFunc-2         2.08µs ± 1%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            14.0µs ± 0%
Middleware_control-2                    4.31µs ± 2%

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 ± 6%
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%

@github-actions
Copy link

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-2                22.8µs ±13%    22.1µs ± 2%     ~     (p=1.000 n=5+5)
_directGzipHead-2            21.9µs ± 2%    22.6µs ±14%     ~     (p=1.000 n=5+5)
_noDirectGzip-2               122µs ± 1%     122µs ± 2%     ~     (p=0.841 n=5+5)
_directGzip_decode-2          443µs ± 1%     441µs ± 1%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2        122µs ± 1%     121µs ± 1%     ~     (p=0.222 n=5+5)
_jsonBody-2                  41.2µs ± 2%    40.6µs ± 1%     ~     (p=0.151 n=5+5)
_jsonBodyValidation-2        46.6µs ± 3%    47.2µs ± 2%     ~     (p=0.310 n=5+5)
_outputHeaders-2             21.0µs ± 2%    21.1µs ± 1%     ~     (p=0.548 n=5+5)
_requestResponseMapping-2    40.4µs ± 3%    40.0µs ± 2%     ~     (p=0.548 n=5+5)
_validation-2                43.2µs ± 1%    42.8µs ± 2%     ~     (p=0.333 n=5+5)
_noValidation-2              31.4µs ± 2%    31.4µs ± 2%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                23.8µs ±16%    23.0µs ± 4%     ~     (p=0.841 n=5+5)
_directGzipHead-2            22.6µs ± 2%    23.4µs ± 1%   +3.30%  (p=0.032 n=5+4)
_noDirectGzip-2               122µs ± 1%     122µs ± 1%     ~     (p=0.548 n=5+5)
_directGzip_decode-2          442µs ± 1%     444µs ± 2%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2        121µs ± 1%     121µs ± 1%     ~     (p=0.548 n=5+5)
_htmlResponse-2              36.2µs ± 3%    36.0µs ± 1%     ~     (p=1.000 n=5+5)
_jsonBodyManual-2            25.7µs ± 1%    25.4µs ± 2%     ~     (p=0.222 n=5+5)
_jsonBody-2                  37.4µs ± 3%    37.3µs ± 1%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-2        48.1µs ± 3%    47.6µs ± 3%     ~     (p=0.421 n=5+5)
_outputHeaders-2             22.0µs ± 3%    21.9µs ± 1%     ~     (p=0.690 n=5+5)
_requestResponseMapping-2    40.1µs ± 2%    40.5µs ± 2%     ~     (p=0.310 n=5+5)
_validation-2                42.8µs ± 1%    42.9µs ± 1%     ~     (p=0.841 n=5+5)
_noValidation-2              32.0µs ± 3%    32.0µs ± 3%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               25.4µs ± 1%    25.0µs ± 0%     ~     (p=0.114 n=4+4)
_ok-2                        25.4µs ± 0%    25.5µs ± 1%     ~     (p=0.690 n=5+5)
_invalidBody-2               36.6µs ± 3%    35.9µs ± 1%     ~     (p=0.310 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.09 ±11%      1.09 ± 4%     ~     (p=0.310 n=5+5)
_directGzipHead-2              1.04 ± 7%      1.09 ± 8%     ~     (p=0.095 n=5+5)
_noDirectGzip-2                5.85 ± 5%      5.85 ± 4%     ~     (p=0.794 n=5+5)
_directGzip_decode-2           18.2 ± 8%      17.7 ± 5%     ~     (p=0.389 n=5+5)
_noDirectGzip_decode-2         6.00 ± 5%      5.86 ± 4%     ~     (p=0.310 n=5+5)
_jsonBody-2                    1.90 ± 6%      1.87 ± 2%     ~     (p=0.151 n=5+5)
_jsonBodyValidation-2          2.12 ± 1%      2.10 ± 5%     ~     (p=0.690 n=5+5)
_outputHeaders-2               1.04 ± 3%      1.03 ± 4%     ~     (p=1.000 n=5+5)
_requestResponseMapping-2      1.78 ± 4%      1.78 ± 8%     ~     (p=0.690 n=5+5)
_validation-2                  1.92 ± 3%      1.87 ± 5%     ~     (p=0.222 n=5+5)
_noValidation-2                1.41 ± 6%      1.39 ± 3%     ~     (p=0.651 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  1.12 ± 7%      1.09 ± 3%     ~     (p=0.421 n=5+5)
_directGzipHead-2              1.14 ± 3%      1.14 ± 9%     ~     (p=0.841 n=5+5)
_noDirectGzip-2                5.82 ± 3%      5.92 ± 7%     ~     (p=0.841 n=5+5)
_directGzip_decode-2           17.1 ± 6%      18.0 ± 7%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2         5.82 ± 2%      5.92 ± 5%     ~     (p=0.841 n=5+5)
_htmlResponse-2                1.68 ± 1%      1.70 ± 5%     ~     (p=0.222 n=5+5)
_jsonBodyManual-2              1.27 ± 7%      1.19 ± 2%     ~     (p=0.222 n=5+5)
_jsonBody-2                    1.69 ± 5%      1.71 ± 5%     ~     (p=0.690 n=5+5)
_jsonBodyValidation-2          2.09 ± 6%      2.14 ± 7%     ~     (p=0.548 n=5+5)
_outputHeaders-2               1.02 ± 3%      1.02 ± 8%     ~     (p=0.841 n=5+5)
_requestResponseMapping-2      1.76 ± 4%      1.77 ± 4%     ~     (p=0.841 n=5+5)
_validation-2                  1.88 ± 7%      1.92 ± 8%     ~     (p=0.548 n=5+5)
_noValidation-2                1.46 ± 7%      1.48 ± 8%     ~     (p=0.841 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 1.26 ± 4%      1.22 ± 3%     ~     (p=0.222 n=5+5)
_ok-2                          1.24 ± 5%      1.20 ± 8%     ~     (p=0.079 n=5+5)
_invalidBody-2                 1.61 ± 3%      1.62 ± 7%     ~     (p=0.690 n=5+5)

name                       old 90%:ms     new 90%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  1.81 ± 4%      1.90 ± 6%     ~     (p=0.056 n=5+5)
_directGzipHead-2              1.85 ± 8%      1.91 ± 6%     ~     (p=0.310 n=5+5)
_noDirectGzip-2                10.4 ± 2%      10.6 ± 3%     ~     (p=0.151 n=5+5)
_directGzip_decode-2           37.0 ±11%      37.4 ± 4%     ~     (p=0.389 n=5+5)
_noDirectGzip_decode-2         10.7 ± 4%      10.7 ± 3%     ~     (p=1.000 n=5+5)
_jsonBody-2                    3.69 ± 5%      3.61 ± 8%     ~     (p=0.310 n=5+5)
_jsonBodyValidation-2          4.16 ± 2%      4.17 ± 5%     ~     (p=0.690 n=5+5)
_outputHeaders-2               1.75 ± 2%      1.75 ± 4%     ~     (p=1.000 n=5+5)
_requestResponseMapping-2      3.76 ± 6%      3.61 ± 4%     ~     (p=0.222 n=5+5)
_validation-2                  3.88 ± 5%      3.85 ± 6%     ~     (p=0.802 n=5+5)
_noValidation-2                2.76 ± 5%      2.73 ± 2%     ~     (p=0.841 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  1.94 ± 7%      1.96 ± 4%     ~     (p=0.690 n=5+5)
_directGzipHead-2              1.90 ± 5%      1.93 ± 9%     ~     (p=1.000 n=5+5)
_noDirectGzip-2                10.7 ± 4%      10.6 ± 4%     ~     (p=0.952 n=5+5)
_directGzip_decode-2           38.7 ± 9%      36.8 ± 5%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2         10.5 ± 3%      10.4 ± 2%     ~     (p=1.000 n=5+5)
_htmlResponse-2                3.19 ± 6%      3.25 ± 5%     ~     (p=0.841 n=5+5)
_jsonBodyManual-2              2.10 ± 2%      2.12 ± 6%     ~     (p=0.595 n=5+5)
_jsonBody-2                    3.37 ± 4%      3.45 ± 3%     ~     (p=0.310 n=5+5)
_jsonBodyValidation-2          4.46 ± 5%      4.33 ±13%     ~     (p=0.222 n=5+5)
_outputHeaders-2               1.78 ± 4%      1.82 ± 6%     ~     (p=0.690 n=5+5)
_requestResponseMapping-2      3.71 ± 3%      3.82 ± 6%     ~     (p=0.151 n=5+5)
_validation-2                  3.90 ± 5%      3.89 ± 4%     ~     (p=1.000 n=5+5)
_noValidation-2                2.79 ± 7%      2.79 ± 2%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 2.17 ± 8%      2.14 ± 8%     ~     (p=0.421 n=5+5)
_ok-2                          2.13 ± 3%      2.17 ± 5%     ~     (p=0.548 n=5+5)
_invalidBody-2                 3.18 ± 5%      3.15 ± 6%     ~     (p=0.841 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.08 ±16%      3.17 ± 5%     ~     (p=0.286 n=4+5)
_directGzipHead-2              3.27 ± 8%      3.12 ± 5%     ~     (p=0.286 n=5+4)
_noDirectGzip-2                14.2 ± 6%      14.5 ± 4%     ~     (p=0.389 n=5+5)
_directGzip_decode-2           60.0 ± 9%      58.8 ±10%     ~     (p=0.548 n=5+5)
_noDirectGzip_decode-2         14.3 ± 4%      14.2 ± 9%     ~     (p=0.841 n=5+5)
_jsonBody-2                    6.24 ±13%      5.74 ±10%     ~     (p=0.310 n=5+5)
_jsonBodyValidation-2          6.90 ±24%      6.92 ±11%     ~     (p=0.690 n=5+5)
_outputHeaders-2               3.33 ± 6%      3.40 ± 8%     ~     (p=0.548 n=5+5)
_requestResponseMapping-2      7.34 ±20%      6.37 ±11%     ~     (p=0.151 n=5+5)
_validation-2                  7.58 ±14%      6.37 ±11%  -16.01%  (p=0.008 n=5+5)
_noValidation-2                5.28 ±16%      5.30 ±13%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  3.24 ± 2%      3.32 ± 9%     ~     (p=1.000 n=4+5)
_directGzipHead-2              3.44 ± 7%      3.50 ± 6%     ~     (p=0.556 n=5+4)
_noDirectGzip-2                14.8 ± 7%      14.3 ± 5%     ~     (p=0.310 n=5+5)
_directGzip_decode-2           61.7 ± 9%      60.1 ±10%     ~     (p=0.690 n=5+5)
_noDirectGzip_decode-2         14.2 ± 4%      14.7 ± 5%     ~     (p=0.222 n=5+5)
_htmlResponse-2                5.63 ±17%      5.52 ±20%     ~     (p=0.548 n=5+5)
_jsonBodyManual-2              3.91 ±17%      3.73 ± 8%     ~     (p=0.548 n=5+5)
_jsonBody-2                    6.38 ±17%      6.04 ± 8%     ~     (p=0.841 n=5+5)
_jsonBodyValidation-2          7.07 ±15%      7.17 ±15%     ~     (p=1.000 n=5+5)
_outputHeaders-2               3.96 ±24%      3.69 ± 3%     ~     (p=0.421 n=5+5)
_requestResponseMapping-2      6.18 ± 9%      6.84 ±10%     ~     (p=0.063 n=5+5)
_validation-2                  6.24 ±14%      6.66 ± 9%     ~     (p=0.310 n=5+5)
_noValidation-2                5.52 ±12%      5.35 ± 5%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 3.45 ± 7%      3.33 ± 2%     ~     (p=0.200 n=4+4)
_ok-2                          3.49 ± 1%      3.50 ± 6%     ~     (p=0.690 n=5+5)
_invalidBody-2                 6.18 ±17%      5.89 ±11%     ~     (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                 8.90 ±101%      5.72 ±43%     ~     (p=1.000 n=5+5)
_directGzipHead-2              6.12 ± 7%      6.99 ±84%     ~     (p=0.905 n=4+5)
_noDirectGzip-2                18.5 ±12%      18.7 ± 9%     ~     (p=1.000 n=5+5)
_directGzip_decode-2           79.6 ± 8%      75.1 ±10%     ~     (p=0.421 n=5+5)
_noDirectGzip_decode-2         17.0 ± 7%      18.0 ±23%     ~     (p=0.690 n=5+5)
_jsonBody-2                    10.5 ±26%      11.0 ±48%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-2          10.4 ±60%      13.1 ±27%     ~     (p=0.103 n=5+5)
_outputHeaders-2               8.84 ±52%      7.57 ±22%     ~     (p=0.421 n=5+5)
_requestResponseMapping-2      13.8 ±17%      12.6 ±14%     ~     (p=0.198 n=5+5)
_validation-2                  13.8 ±21%      12.3 ±31%     ~     (p=0.421 n=5+5)
_noValidation-2                12.1 ±34%      10.0 ±34%     ~     (p=0.222 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  7.36 ±94%      6.24 ±28%     ~     (p=1.000 n=5+5)
_directGzipHead-2              5.64 ±23%      9.68 ±73%  +71.55%  (p=0.032 n=5+5)
_noDirectGzip-2                19.2 ± 6%      18.1 ± 3%   -5.85%  (p=0.032 n=5+5)
_directGzip_decode-2           80.4 ±11%      70.4 ±11%  -12.51%  (p=0.032 n=5+5)
_noDirectGzip_decode-2         17.3 ± 6%      18.2 ± 6%     ~     (p=0.151 n=5+5)
_htmlResponse-2                9.63 ±62%     10.12 ±60%     ~     (p=0.690 n=5+5)
_jsonBodyManual-2              7.34 ±33%      7.14 ±26%     ~     (p=1.000 n=5+5)
_jsonBody-2                    11.3 ±30%      10.5 ±24%     ~     (p=0.690 n=5+5)
_jsonBodyValidation-2          11.4 ± 1%      10.3 ± 7%   -9.44%  (p=0.016 n=4+5)
_outputHeaders-2               9.12 ±43%      9.13 ±27%     ~     (p=0.841 n=5+5)
_requestResponseMapping-2      10.4 ±20%      12.6 ±10%     ~     (p=0.056 n=5+5)
_validation-2                  11.2 ±31%      11.4 ±26%     ~     (p=1.000 n=5+5)
_noValidation-2                10.8 ±42%      11.5 ± 8%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                9.33 ±108%      5.36 ±20%     ~     (p=0.413 n=5+4)
_ok-2                          5.64 ±25%      6.05 ±50%     ~     (p=0.841 n=5+5)
_invalidBody-2                 9.69 ±31%     10.09 ±50%     ~     (p=1.000 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                   639 ± 0%       639 ± 0%     ~     (all equal)
_directGzipHead-2               183 ± 0%       183 ± 0%     ~     (all equal)
_noDirectGzip-2               1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_directGzip_decode-2            639 ± 0%       639 ± 0%     ~     (all equal)
_noDirectGzip_decode-2        1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_jsonBody-2                     208 ± 0%       208 ± 0%     ~     (all equal)
_jsonBodyValidation-2           194 ± 0%       194 ± 0%     ~     (all equal)
_outputHeaders-2                155 ± 0%       155 ± 0%     ~     (all equal)
_requestResponseMapping-2      94.0 ± 0%      94.0 ± 0%     ~     (all equal)
_validation-2                   177 ± 0%       177 ± 0%     ~     (all equal)
_noValidation-2                 177 ± 0%       177 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                   653 ± 0%       653 ± 0%     ~     (all equal)
_directGzipHead-2               197 ± 0%       197 ± 0%     ~     (all equal)
_noDirectGzip-2               1.06k ± 0%     1.06k ± 0%     ~     (all equal)
_directGzip_decode-2            653 ± 0%       653 ± 0%     ~     (all equal)
_noDirectGzip_decode-2        1.06k ± 0%     1.06k ± 0%     ~     (all equal)
_htmlResponse-2                 370 ± 0%       370 ± 0%     ~     (all equal)
_jsonBodyManual-2               222 ± 0%       222 ± 0%     ~     (all equal)
_jsonBody-2                     222 ± 0%       222 ± 0%     ~     (all equal)
_jsonBodyValidation-2           208 ± 0%       208 ± 0%     ~     (all equal)
_outputHeaders-2                169 ± 0%       169 ± 0%     ~     (all equal)
_requestResponseMapping-2       108 ± 0%       108 ± 0%     ~     (all equal)
_validation-2                   191 ± 0%       191 ± 0%     ~     (all equal)
_noValidation-2                 191 ± 0%       191 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                  337 ± 0%       337 ± 0%     ~     (all equal)
_ok-2                           359 ± 0%       359 ± 0%     ~     (all equal)
_invalidBody-2                  435 ± 0%       435 ± 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                 44.1k ±12%     45.3k ± 2%     ~     (p=1.000 n=5+5)
_directGzipHead-2             45.6k ± 2%     44.4k ±13%     ~     (p=1.000 n=5+5)
_noDirectGzip-2               8.22k ± 1%     8.22k ± 2%     ~     (p=0.730 n=5+5)
_directGzip_decode-2          2.26k ± 1%     2.27k ± 1%     ~     (p=0.135 n=5+5)
_noDirectGzip_decode-2        8.23k ± 1%     8.28k ± 1%     ~     (p=0.222 n=5+5)
_jsonBody-2                   24.3k ± 2%     24.6k ± 1%     ~     (p=0.151 n=5+5)
_jsonBodyValidation-2         21.5k ± 3%     21.2k ± 2%     ~     (p=0.310 n=5+5)
_outputHeaders-2              47.6k ± 2%     47.4k ± 1%     ~     (p=0.548 n=5+5)
_requestResponseMapping-2     24.8k ± 3%     25.0k ± 2%     ~     (p=0.548 n=5+5)
_validation-2                 23.2k ± 1%     23.4k ± 2%     ~     (p=0.421 n=5+5)
_noValidation-2               31.8k ± 2%     31.8k ± 2%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                 42.3k ±14%     43.5k ± 3%     ~     (p=0.841 n=5+5)
_directGzipHead-2             44.2k ± 2%     42.8k ± 1%   -3.21%  (p=0.032 n=5+4)
_noDirectGzip-2               8.22k ± 1%     8.20k ± 1%     ~     (p=0.421 n=5+5)
_directGzip_decode-2          2.26k ± 1%     2.25k ± 2%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2        8.26k ± 1%     8.23k ± 1%     ~     (p=0.548 n=5+5)
_htmlResponse-2               27.7k ± 3%     27.8k ± 1%     ~     (p=1.000 n=5+5)
_jsonBodyManual-2             38.9k ± 1%     39.3k ± 2%     ~     (p=0.222 n=5+5)
_jsonBody-2                   26.8k ± 3%     26.8k ± 1%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-2         20.8k ± 3%     21.0k ± 3%     ~     (p=0.421 n=5+5)
_outputHeaders-2              45.4k ± 3%     45.7k ± 1%     ~     (p=0.690 n=5+5)
_requestResponseMapping-2     24.9k ± 2%     24.6k ± 2%     ~     (p=0.310 n=5+5)
_validation-2                 23.4k ± 1%     23.3k ± 1%     ~     (p=0.841 n=5+5)
_noValidation-2               31.3k ± 3%     31.3k ± 3%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                39.4k ± 1%     40.0k ± 0%     ~     (p=0.114 n=4+4)
_ok-2                         39.3k ± 0%     39.2k ± 1%     ~     (p=0.690 n=5+5)
_invalidBody-2                27.3k ± 3%     27.8k ± 1%     ~     (p=0.310 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.92kB ± 0%    3.92kB ± 0%     ~     (p=0.873 n=4+5)
_directGzipHead-2            3.92kB ± 0%    3.92kB ± 0%     ~     (p=0.365 n=5+5)
_noDirectGzip-2              6.75kB ±19%    6.68kB ±19%     ~     (p=0.841 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%     ~     (p=0.310 n=5+5)
_noDirectGzip_decode-2       5.92kB ± 8%    5.61kB ± 7%     ~     (p=0.310 n=5+5)
_jsonBody-2                  13.2kB ± 0%    13.2kB ± 0%     ~     (p=0.730 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%     ~     (p=0.333 n=5+5)
_outputHeaders-2             3.71kB ± 0%    3.71kB ± 0%   -0.04%  (p=0.016 n=5+4)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.111 n=5+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.302 n=5+5)
_noValidation-2              7.89kB ± 0%    7.89kB ± 0%     ~     (p=0.571 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                3.97kB ± 0%    3.97kB ± 0%     ~     (p=1.000 n=4+5)
_directGzipHead-2            3.97kB ± 0%    3.97kB ± 0%     ~     (p=0.333 n=5+5)
_noDirectGzip-2              6.99kB ±16%    6.90kB ±17%     ~     (p=0.841 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%     ~     (p=0.421 n=5+5)
_noDirectGzip_decode-2       6.05kB ±12%    6.11kB ± 8%     ~     (p=0.690 n=5+5)
_htmlResponse-2              8.25kB ± 0%    8.25kB ± 0%     ~     (p=0.984 n=5+5)
_jsonBodyManual-2            4.65kB ± 0%    4.65kB ± 0%     ~     (p=0.397 n=5+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.524 n=5+5)
_outputHeaders-2             3.74kB ± 0%    3.74kB ± 0%     ~     (p=0.444 n=5+5)
_requestResponseMapping-2    16.8kB ± 0%    16.8kB ± 0%     ~     (p=0.810 n=5+5)
_validation-2                16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.659 n=5+5)
_noValidation-2              7.95kB ± 0%    7.95kB ± 0%     ~     (p=0.595 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.230 n=5+5)
_ok-2                        4.79kB ± 0%    4.79kB ± 0%     ~     (p=0.229 n=4+4)
_invalidBody-2               8.63kB ± 0%    8.63kB ± 0%     ~     (p=0.343 n=4+4)

name                       old allocs/op  new allocs/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  42.0 ± 0%      42.0 ± 0%     ~     (all equal)
_directGzipHead-2              42.0 ± 0%      42.0 ± 0%     ~     (all equal)
_noDirectGzip-2                49.4 ± 3%      49.4 ± 3%     ~     (p=1.000 n=5+5)
_directGzip_decode-2            501 ± 0%       502 ± 0%   +0.20%  (p=0.029 n=4+4)
_noDirectGzip_decode-2         50.0 ± 0%      50.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                  44.0 ± 0%      44.0 ± 0%     ~     (all equal)
_directGzipHead-2              44.0 ± 0%      44.0 ± 0%     ~     (all equal)
_noDirectGzip-2                51.4 ± 3%      51.4 ± 3%     ~     (p=1.000 n=5+5)
_directGzip_decode-2            504 ± 0%       504 ± 0%     ~     (p=0.643 n=5+5)
_noDirectGzip_decode-2         52.0 ± 0%      52.0 ± 0%     ~     (all equal)
_htmlResponse-2                 145 ± 0%       145 ± 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               38.0 ± 0%      38.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)

@vearutop vearutop marked this pull request as ready for review January 16, 2023 21:16
@vearutop vearutop merged commit 3e957d5 into master Jan 16, 2023
@vearutop vearutop deleted the resp-error branch January 16, 2023 21:19
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.

Custom error message is not used for response validation errors
1 participant