mccutchen / go-httpbin

A reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib.
https://httpbingo.org
MIT License
596 stars 124 forks source link

fix: /base64 endpoint decodes both URL-safe and standard b64 encodings #153

Closed mccutchen closed 1 year ago

mccutchen commented 1 year ago

As reported in #152, the /base64 endpoint can only decode the "URL-safe" base64 encoding, but the error it returns is not very useful if you're not already familiar with different base64 encoding variants.

Here we follow Postel's law and accept either the URL-safe or standard encodings, while continuing to use the URL-safe variant when encoding ourselves.

Fixes #152.

codecov[bot] commented 1 year ago

Codecov Report

Merging #153 (a6e3060) into main (e3c4f8d) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #153   +/-   ##
=======================================
  Coverage   98.04%   98.05%           
=======================================
  Files           8        8           
  Lines        1588     1591    +3     
=======================================
+ Hits         1557     1560    +3     
  Misses         22       22           
  Partials        9        9           
Files Coverage Δ
httpbin/helpers.go 96.64% <100.00%> (+0.03%) :arrow_up: