gin icon indicating copy to clipboard operation
gin copied to clipboard

export ErrUnknownType and code adjust for broken pipe and json invalid and use http.MethodGet instead of raw GET string and IsWebsocket check

Open daheige opened this issue 2 years ago • 6 comments

1.export ErrUnknownType unknown request type 2.code adjust for broken pipe and json invalid and use http.MethodGet instead of raw GET string 3.IsWebsocket check

daheige avatar Jul 11 '21 06:07 daheige

Codecov Report

Merging #2785 (5060a60) into master (696d37e) will decrease coverage by 0.06%. The diff coverage is 100.00%.

:exclamation: Current head 5060a60 differs from pull request most recent head 21fe9c2. Consider uploading reports for the commit 21fe9c2 to get more accurate results

@@            Coverage Diff             @@
##           master    #2785      +/-   ##
==========================================
- Coverage   98.77%   98.71%   -0.07%     
==========================================
  Files          41       41              
  Lines        3106     2094    -1012     
==========================================
- Hits         3068     2067    -1001     
+ Misses         26       15      -11     
  Partials       12       12              
Flag Coverage Δ
go-1.14 ?
go-1.15 ?
go-1.16 ?
go-1.17 ?
go-1.18 ?
macos-latest ?
nomsgpack ?
ubuntu-latest ?

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

Impacted Files Coverage Δ
binding/binding_nomsgpack.go 100.00% <100.00%> (ø)
binding/form_mapping.go 100.00% <100.00%> (ø)
binding/json.go 100.00% <100.00%> (ø)
context.go 97.68% <100.00%> (-0.24%) :arrow_down:
recovery.go 97.22% <100.00%> (-0.86%) :arrow_down:
utils.go 96.82% <0.00%> (-0.18%) :arrow_down:
response_writer.go 93.33% <0.00%> (-0.15%) :arrow_down:
gin.go 99.18% <0.00%> (-0.01%) :arrow_down:
... and 36 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 696d37e...21fe9c2. Read the comment docs.

codecov[bot] avatar Jul 11 '21 06:07 codecov[bot]

@appleboy @thinkerou

daheige avatar Jul 12 '21 13:07 daheige

The name you said is OK, but the JSON request request is illegal. I'll adjust it appropriately.

------------------ Original ------------------ From: Bo-Yi Wu @.> Date: Tue,Jul 13,2021 9:46 AM To: gin-gonic/gin @.> Cc: heige @.>, Author @.> Subject: Re: [gin-gonic/gin] export ErrUnknownType and code adjust for broken pipe and json invalid and use http.MethodGet instead of raw GET string and IsWebsocket check (#2785)

@appleboy commented on this pull request.

In binding/json.go: > -// keys which do not match any non-ignored, exported fields in the destination. -var EnableDecoderDisallowUnknownFields = false +var ( +// EnableDecoderUseNumber is used to call the UseNumber method on the JSON +// Decoder instance. UseNumber causes the Decoder to unmarshal a number into an +// interface{} as a Number instead of as a float64. +EnableDecoderUseNumber = false + +// EnableDecoderDisallowUnknownFields is used to call the DisallowUnknownFields method +// on the JSON Decoder instance. DisallowUnknownFields causes the Decoder to +// return an error when the destination is a struct and the input contains object +// keys which do not match any non-ignored, exported fields in the destination. +EnableDecoderDisallowUnknownFields = false + +// JsonReqInvalid json invalid when request is nil or request body is nil. +JsonReqInvalid = errors.New("invalid request")
Maybe InvaildRequest?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

daheige avatar Jul 13 '21 01:07 daheige

yes,I see that other components of gin are in use. Here, it is declared as an open method to facilitate reuse.

------------------ Original ------------------ From: thinkerou @.> Date: Thu,Jul 22,2021 8:00 AM To: gin-gonic/gin @.> Cc: heige @.>, Author @.> Subject: Re: [gin-gonic/gin] export ErrUnknownType and code adjust for broken pipe and json invalid and use http.MethodGet instead of raw GET string and IsWebsocket check (#2785)

@thinkerou commented on this pull request.

In recovery.go: > @@ -47,6 +47,20 @@ func RecoveryWithWriter(out io.Writer, recovery ...RecoveryFunc) HandlerFunc { return CustomRecoveryWithWriter(out, defaultHandleRecovery) } +// IsBroken Check error for a broken connection +func IsBroken(err interface{}) bool {
public method?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

daheige avatar Jul 22 '21 00:07 daheige

@daheige Please help to resolve conflicts.

appleboy avatar Apr 16 '22 01:04 appleboy

i have adjusted it ok, thinks.

原始邮件 发件人: Bo-Yi @.> 收件人: @.> 抄送: @.>; @.> 发送时间: 2022年4月16日(周六) 09:54 主题: Re: [gin-gonic/gin] export ErrUnknownType and code adjust for brokenpipe and json invalid and use http.MethodGet instead of raw GET string andIsWebsocket check (#2785)

@daheige Please help to resolve conflicts. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

daheige avatar Apr 18 '22 14:04 daheige