-
-
Notifications
You must be signed in to change notification settings - Fork 414
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
QueryParamForm Combinator #729
base: master
Are you sure you want to change the base?
Conversation
@@ -405,6 +406,48 @@ instance (KnownSymbol sym, HasServer api context) | |||
examine v | v == "true" || v == "1" || v == "" = True | |||
| otherwise = False | |||
|
|||
-- | If you use @'QueryParamForm' BookSearchParams@ in one of the endpoints for your API, | |||
-- this automatically requires your server-side handler to be a function | |||
-- that takes an argument of type @['BookSearchParams']@. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of type @'BookSearchParams'@
, right?
-- > { authors :: [Text] | ||
-- > , page :: Maybe Int | ||
-- > } deriving (Generic) | ||
-- > instance FromForm BookSearchParams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably mention that we default implementation uses FromHttpApiData
for each field.
subserver `addParameterCheck` withRequest paramsCheck | ||
where | ||
paramsCheck req = | ||
case urlDecodeAsForm (BL.drop 1 . BL.fromStrict $ rawQueryString req) of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess BL.drop 1
is about dropping leading ?
?
Can rawQueryString
contain extra info (e.g. HTML anchors?), would it ruin parsing?
Also, I don't see any changes for |
@fizruk the |
@isairz are you going to work on this soon or should we take over? |
@fizruk Sorry, I was so busy and did not care. |
#728
This is my first pull request in servant.
Please feel free to review my commits 😃