resty icon indicating copy to clipboard operation
resty copied to clipboard

Fix SetAllowGetMethodPayload option ignored for io.Reader payload

Open picollomartin opened this issue 3 years ago • 1 comments
trafficstars

Hi 👋 !

We detect some inconsistent behaviour of the current implementation of the SetAllowGetMethodPayload based on the input type passed to SetBody option:

  • SetAllowGetMethodPayload = false

    • Body type = io.Reader => body is sent in GET
    • Body type = non io.Reader => body is not sent in GET
  • SetAllowGetMethodPayload = true

    • Body type = io.Reader => body is sent in GET
    • Body type = non io.Reader => body is sent in GET

Basically you can bypass the option AllowGetMethodPayload if you send an io.Reader as a Body, this fixes that for be consistent to all types and add a test case for test disabled option

picollomartin avatar May 06 '22 16:05 picollomartin

Codecov Report

Merging #541 (0f75cb5) into master (45d9f8b) will decrease coverage by 0.55%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #541      +/-   ##
==========================================
- Coverage   96.39%   95.84%   -0.55%     
==========================================
  Files          10       10              
  Lines        1330     1325       -5     
==========================================
- Hits         1282     1270      -12     
- Misses         30       34       +4     
- Partials       18       21       +3     
Impacted Files Coverage Δ
middleware.go 91.27% <100.00%> (-1.59%) :arrow_down:
request.go 95.25% <0.00%> (-1.10%) :arrow_down:

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

codecov[bot] avatar Jul 19 '22 23:07 codecov[bot]

@picollomartin I'm sorry for the delayed attention on the PR. Thank you for your contribution. Agreed, inconsistent behavior will lead to consuming investigation time. This PR provided insight for #618.

jeevatkm avatar Mar 06 '23 00:03 jeevatkm