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: add option explode to control how query params are handled. #58

Merged
merged 4 commits into from
Feb 11, 2019

Conversation

wI2L
Copy link
Collaborator

@wI2L wI2L commented Jan 28, 2019

Behavior

With explode:"true" (default)

Foobar []string `query:"foobar"`
?foobar=1,2,3
[]string{ "1,2,3" }
Foobar string `query:"foobar"`
?foobar=1&foobar=2
"error": "binding error on field 'Foobar' of type 'XXX': multiple values not supported"

With explode:"false"

Foobar []string `query:"foobar" explode:"false"`
?foobar=1,2,3
[]string{"1","2","3"}
Foobar string `query:"foobar"`
?foobar=1,2,3
"error": "binding error on field 'Foobar' of type 'XXX': multiple values not supported"

This should continue to play nicely with the enum tag since the logic about that is handled after the extraction of the query parameters.

@wI2L wI2L requested review from rbeuque74 and loopfz January 28, 2019 13:21
@wI2L wI2L force-pushed the query-params-explode branch from eb40733 to 5c1f96f Compare January 28, 2019 13:27
@wI2L wI2L self-assigned this Jan 28, 2019
tonic/handler.go Outdated Show resolved Hide resolved
tonic/tonic.go Show resolved Hide resolved
tonic/handler.go Outdated Show resolved Hide resolved
tonic/handler.go Outdated Show resolved Hide resolved
tonic/tonic.go Outdated Show resolved Hide resolved
@wI2L wI2L force-pushed the query-params-explode branch from 5c1f96f to 1afc764 Compare January 29, 2019 09:45
@wI2L wI2L force-pushed the query-params-explode branch 2 times, most recently from 7b3b9ed to a2c52c3 Compare January 29, 2019 12:56
wI2L added a commit to wI2L/fizz that referenced this pull request Jan 29, 2019
@wI2L wI2L force-pushed the query-params-explode branch 4 times, most recently from 0232833 to 68abd0f Compare February 11, 2019 15:24
@wI2L wI2L force-pushed the query-params-explode branch from 68abd0f to 00aaaff Compare February 11, 2019 15:27
@loopfz loopfz merged commit 66acbcf into master Feb 11, 2019
@loopfz loopfz deleted the query-params-explode branch March 8, 2019 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants