Skip to content
New issue

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

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

Already on GitHub? # to your account

chore(http): add support for go1.20 http.rwUnwrapper to gin.responseWriter #3489

Merged
merged 1 commit into from
Feb 12, 2023

Conversation

davidmdm
Copy link
Contributor

@davidmdm davidmdm commented Feb 4, 2023

This PR implements the go1.20 http.rwUnwrapper interface on the private gin.responseWriter type:

type rwUnwrapper interface {
	Unwrap() ResponseWriter
}

This will allow code using go1.20 to use the http.ResponseController utility type added in go1.20.

engine.GET("/path", func (c *gin.Context) {
  controller := http.NewResponseController(c.Writer)
  controller.SetWriteDeadline(time.Second)
  // ...
}

@davidmdm davidmdm changed the title add supprt for go1.20 http.rwUnwrapper to gin.responseWriter add support for go1.20 http.rwUnwrapper to gin.responseWriter Feb 4, 2023
@appleboy appleboy added this to the v1.9 milestone Feb 5, 2023
@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Merging #3489 (7019960) into master (c5fd063) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3489   +/-   ##
=======================================
  Coverage   98.63%   98.63%           
=======================================
  Files          42       42           
  Lines        3140     3142    +2     
=======================================
+ Hits         3097     3099    +2     
  Misses         29       29           
  Partials       14       14           
Flag Coverage Δ
98.63% <100.00%> (+<0.01%) ⬆️
go-1.16 ∅ <ø> (?)
go-1.17 98.53% <100.00%> (+<0.01%) ⬆️
go-1.18 98.53% <100.00%> (+<0.01%) ⬆️
go-1.19 98.63% <100.00%> (+<0.01%) ⬆️
macos-latest 98.63% <100.00%> (+0.09%) ⬆️
ubuntu-latest 98.63% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
response_writer.go 93.87% <100.00%> (+0.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@appleboy appleboy changed the title add support for go1.20 http.rwUnwrapper to gin.responseWriter chore(http): add support for go1.20 http.rwUnwrapper to gin.responseWriter Feb 6, 2023
@appleboy
Copy link
Member

@thinkerou help to review.

@thinkerou thinkerou merged commit c1d06e3 into gin-gonic:master Feb 12, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants