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

Allow multipart/form-data in PATCH request #536

Merged
merged 2 commits into from Mar 6, 2023

Conversation

sabandi
Copy link
Contributor

@sabandi sabandi commented Apr 15, 2022

No description provided.

@codecov
Copy link

codecov bot commented Apr 16, 2022

Codecov Report

Merging #536 (2f4e675) into master (313f419) will decrease coverage by 0.31%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #536      +/-   ##
==========================================
- Coverage   96.69%   96.39%   -0.31%     
==========================================
  Files          10       10              
  Lines        1330     1330              
==========================================
- Hits         1286     1282       -4     
- Misses         26       30       +4     
  Partials       18       18              
Impacted Files Coverage Δ
middleware.go 92.85% <100.00%> (ø)
request.go 96.35% <0.00%> (-1.46%) ⬇️

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

@sabandi
Copy link
Contributor Author

sabandi commented Apr 25, 2022

@jeevatkm could you please review this change.

@moorereason
Copy link
Contributor

Seems simple enough. We obviously don't have tests around this code. Do you have time to add tests?

@sabandi
Copy link
Contributor Author

sabandi commented Apr 25, 2022

Seems simple enough. We obviously don't have tests around this code. Do you have time to add tests?

@moorereason Added a simple test as per your suggestion. Please review.

@sabandi
Copy link
Contributor Author

sabandi commented Apr 25, 2022

Test result.

~/Desktop/ patch-1 ❯ go test  -run ^TestMultiPartUploadFileViaPatch$ ./...
ok      github.com/go-resty/resty/v2    0.202s

@sabandi
Copy link
Contributor Author

sabandi commented Apr 29, 2022

@moorereason just checking in to see if you got a chance to review this.

Copy link
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

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

@sabandi Thanks you for your PR and contribution. I'm sorry for the delayed attention on the PR.

@@ -128,7 +128,7 @@ func parseRequestHeader(c *Client, r *Request) error {
func parseRequestBody(c *Client, r *Request) (err error) {
if isPayloadSupported(r.Method, c.AllowGetMethodPayload) {
// Handling Multipart
if r.isMultiPart && !(r.Method == MethodPatch) {
Copy link
Member

Choose a reason for hiding this comment

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

@sabandi HTTP spec is keep on getting better!

@jeevatkm jeevatkm merged commit 2fccee5 into go-resty:master Mar 6, 2023
@jeevatkm jeevatkm added this to the v2.8.0 Milestone milestone Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants