-
Notifications
You must be signed in to change notification settings - Fork 712
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
Conversation
Implements `SetAllowGetMethodPayload()` on `go-resty` client to allow developer decides if request includes payload with GET method. fixes #81
Hm, seems travis has a issue on that test? |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
I will check the Travis CI, does Test pass on your local machine? |
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 Report
@@ 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
Continue to review full report at Codecov.
|
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. |
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) |
Hello jeevatkm, please ignore my latest question. I fixed coverage issue (verified locally). |
@liuzhiyan Thank you for you effort and time. I'm not sure why build specifically fails on go1.4 with |
Implements
SetAllowGetMethodPayload()
ongo-resty
client toallow developer decides if request includes payload with GET method.
fixes #81