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

feat: /status endpoint supports weighted choice #162

Merged
merged 1 commit into from
Jan 13, 2024
Merged

Conversation

mccutchen
Copy link
Owner

Fixes compatibility with the original httpbin by making the /status endpoint accept multiple, optionally weighted status codes to choose from. Per the description in #145, this implementation attempts to match original httpbin's behavior:

  • If not specified, weight is 1
  • If specified, weights are parsed as floats, but there is no requirement that they sum to 1.0 or are otherwise limited to any particular range

Fixes #145.

Fixes compatibility with the original httpbin by making the /status
endpoint accept multiple, optionally weighted status codes to choose
from.

Fixes #145.
Copy link

codecov bot commented Jan 13, 2024

Codecov Report

Merging #162 (501020e) into main (1a41486) will increase coverage by 0.07%.
The diff coverage is 98.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
+ Coverage   95.04%   95.11%   +0.07%     
==========================================
  Files           9        9              
  Lines        2119     2171      +52     
==========================================
+ Hits         2014     2065      +51     
- Misses         71       72       +1     
  Partials       34       34              
Files Coverage Δ
httpbin/handlers.go 99.57% <100.00%> (+<0.01%) ⬆️
httpbin/helpers.go 96.74% <97.29%> (+0.06%) ⬆️

@mccutchen mccutchen merged commit b292fe6 into main Jan 13, 2024
8 checks passed
@mccutchen mccutchen deleted the status-choices branch January 13, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/status endpoint should support a weighted choice from multiple codes
1 participant