-
Notifications
You must be signed in to change notification settings - Fork 119
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
[compat] original httpbin returns either lists or scalars depending on input data #37
Comments
I just noticed that this is somewhat a duplicate of #15 but not quite. |
Yeah, I'm really torn on this. While making httpbingo.org a drop-in replacement for (at least the most common/basic functionality of) httpbin.org would be great, that particular pattern is particularly ugly to implement in Go. Maybe I'll take another pass at this and see how bad it really is. |
I think common behaviour is:
Should got {
foo: "12",
bar: "23",
} and then
Should got {
foo: ["12", "23"],
} |
Minor note: There is no special handling of {
"foo[]": ["12", "23"]
} in both projects. Here's original httpbin:
and go-httbin:
Note that the name of the argument is |
@mccutchen Hi, here's my solution to this issue: #73, wish for your comment. |
I've taken a pass at this and #15 from time to time over the last couple of years, but I'm never satisfied with the complexity that it requires. Ultimately, I don't think this (admittedly large) part of backwards-compatibility is worth pursuing, and prefer the consistency of our existing approach: any key-value pair where each key may correspond to one or more values will always be represented as a JSON array (AKA list, slice, etc) with one or more items. I will gladly take a look at future pull requests if someone does come along with an implementation that somehow
|
The answers between httpbin and httpbingo differ. httpbingo will always return an array for each parameter or header, while httpbin will return simple objects and use sub arrays only when needed. I think your behaviour is maybe a more sensible approach, but it's harder to read for humans and makes it hard to use httpbingo as a drop-in replacement for httpbin.
The text was updated successfully, but these errors were encountered: