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

Pass MaxMultipartMemory when FormFile is called #1600

Merged
merged 2 commits into from
Oct 22, 2018

Conversation

isgj
Copy link
Contributor

@isgj isgj commented Oct 17, 2018

When gin.Context.FormFile("...") is called the engine.MaxMultipartMemory is never used. This PR makes sure that the MaxMultipartMemory is passed and removes 2 calls to http.Request.ParseForm since they are called from http.Request.ParseMultipartForm

@codecov
Copy link

codecov bot commented Oct 17, 2018

Codecov Report

Merging #1600 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1600      +/-   ##
==========================================
+ Coverage   99.27%   99.27%   +<.01%     
==========================================
  Files          39       39              
  Lines        1928     1929       +1     
==========================================
+ Hits         1914     1915       +1     
  Misses         10       10              
  Partials        4        4
Impacted Files Coverage Δ
context.go 99.49% <100%> (ø) ⬆️

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 a1a3256...944f9df. Read the comment docs.

@thinkerou
Copy link
Member

@isgj please add some test, thanks!

@isgj
Copy link
Contributor Author

isgj commented Oct 18, 2018

There was already a test for the happy path. I wrote a test when it fails to check that it returns the error. I you think that another type of test can be written just let me know.

context.go Show resolved Hide resolved
Copy link
Member

@thinkerou thinkerou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thinkerou
Copy link
Member

@appleboy please help review, thanks!

@appleboy appleboy added this to the 1.4 milestone Oct 22, 2018
@appleboy appleboy merged commit dbc330b into gin-gonic:master Oct 22, 2018
@isgj isgj deleted the max-multipart branch October 23, 2018 07:10
justinfx pushed a commit to justinfx/gin that referenced this pull request Nov 3, 2018
When `gin.Context.FormFile("...")` is called the `engine.MaxMultipartMemory` is never used. This PR makes sure that the `MaxMultipartMemory` is passed and removes 2 calls to `http.Request.ParseForm` since they are called from `http.Request.ParseMultipartForm`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants