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

Adds an option to support GET method with request body #82

Merged
merged 5 commits into from
Jul 7, 2017
Merged

Adds an option to support GET method with request body #82

merged 5 commits into from
Jul 7, 2017

Conversation

zhiyanliu
Copy link
Contributor

Implements SetAllowGetMethodPayload() on go-resty client to
allow developer decides if request includes payload with GET method.

fixes #81

Implements `SetAllowGetMethodPayload()` on `go-resty` client to
allow developer decides if request includes payload with GET method.

fixes #81
@zhiyanliu
Copy link
Contributor Author

Hm, seems travis has a issue on that test?

https://travis-ci.org/go-resty/resty/jobs/251041705

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.

I have added my review. Please take care.

Please add section in the readme for this feature and also add one liner info under Feature section at the end.

client.go Outdated
@@ -851,8 +861,19 @@ func getPointer(v interface{}) interface{} {
return reflect.New(vv.Type()).Interface()
}

func isPayloadSupported(m string) bool {
return (m == MethodPost || m == MethodPut || m == MethodDelete || m == MethodPatch)
func isPayloadSupported(allowGetMethodPayload bool, m string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Can you please flip the param order?

isPayloadSupported(m string, allowMethodGet bool) bool

Can we simplify to-

return (m == MethodPost || m == MethodPut || m == MethodDelete || m == MethodPatch || (allowMethodGet && m == MethodGet))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

@jeevatkm
Copy link
Member

jeevatkm commented Jul 7, 2017

I will check the Travis CI, does Test pass on your local machine?

@zhiyanliu
Copy link
Contributor Author

Yes, all tests run successfully on my local (go 1.8.3)

Implements `SetAllowGetMethodPayload()` on `go-resty` client to
allow developer decides if request includes payload with GET method.

fixes #81
@codecov
Copy link

codecov bot commented Jul 7, 2017

Codecov Report

Merging #82 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #82      +/-   ##
==========================================
+ Coverage   96.63%   96.65%   +0.01%     
==========================================
  Files           9        9              
  Lines         921      926       +5     
==========================================
+ Hits          890      895       +5     
  Misses         16       16              
  Partials       15       15
Impacted Files Coverage Δ
middleware.go 92.16% <100%> (ø) ⬆️
client.go 95.37% <100%> (+0.04%) ⬆️
default.go 100% <100%> (ø) ⬆️
request.go 100% <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 52992d9...f8dc9f2. Read the comment docs.

@jeevatkm
Copy link
Member

jeevatkm commented Jul 7, 2017

I have checked travis CI, it seems travis having some issue. Your PR passed fully expect go1.4 https://travis-ci.org/go-resty/resty/builds/251050503.

Now PR is marked as failed by Code coverage system, Can you please check the code coverage?

PS: after code coverage fix, I will merge your PR into master. However releasing and tag might take a while.

@zhiyanliu
Copy link
Contributor Author

Hello jeevatkm,

After checking on [0] (and other files [1] as well actually), I think all my changes in the file were already covered by committed test cases, it seems 0.06% decrease caused by total LOC increasing.. would you mind give me some inputs on this?

Thanks!

[0] https://codecov.io/gh/go-resty/resty/pull/82/changes (expand file client.go, only one made coverage changes)
[1] https://codecov.io/gh/go-resty/resty/pull/82/diff

Implements `SetAllowGetMethodPayload()` on `go-resty` client to
allow developer decides if request includes payload with GET method.

fixes #81
@zhiyanliu
Copy link
Contributor Author

Hello jeevatkm, please ignore my latest question. I fixed coverage issue (verified locally).

@jeevatkm
Copy link
Member

jeevatkm commented Jul 7, 2017

@liuzhiyan Thank you for you effort and time.

I'm not sure why build specifically fails on go1.4 with go tool: no such tool "cover"; to install. Don't worry I will take care and merge your PR to master today.

@jeevatkm jeevatkm merged commit 3b0e1a8 into go-resty:master Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Supporting GET method with a request body is an option?
2 participants