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

/status endpoint should support a weighted choice from multiple codes #145

Closed
Tracked by #91
mccutchen opened this issue Sep 7, 2023 · 0 comments · Fixed by #162
Closed
Tracked by #91

/status endpoint should support a weighted choice from multiple codes #145

mccutchen opened this issue Sep 7, 2023 · 0 comments · Fixed by #162
Labels
compat Tracking issues around compatibility with original httpbin implementation

Comments

@mccutchen
Copy link
Owner

Original httpbin supports requests like /status/200,201,400 and /status/200:0.6,201:0.3,400:0.1, and will return a weighted random choice from the specified codes.

Some quick notes on the upstream implementation:

  • 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 (see weighted_choice implementation)
@mccutchen mccutchen added the compat Tracking issues around compatibility with original httpbin implementation label Sep 7, 2023
mccutchen added a commit that referenced this issue Jan 13, 2024
Fixes compatibility with the original httpbin by making the /status
endpoint accept multiple, optionally weighted status codes to choose
from.

Fixes #145.
mccutchen added a commit that referenced this issue Jan 13, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Tracking issues around compatibility with original httpbin implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant