-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
add function to support query string parameter in finch. #528
add function to support query string parameter in finch. #528
Conversation
... CI is not running. |
…one GraphQL Request in finch.
(queryRequest: GraphQLRequest, body: Option[String], contentType: String) => | ||
val request: GraphQLRequest = (queryRequest, body, contentType) match { | ||
case (_, Some(bodyValue), "application/json") => | ||
parse(bodyValue).flatMap(_.as[GraphQLRequest]).getOrElse(GraphQLRequest()) |
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.
Hmm the problem here is that we lose the error message from parse
which could be useful.
Maybe you could return a Task[GraphQLRequest]
instead?
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.
Wrapping the result in Task
and catching error when an error happens.
queryRequest | ||
// treat unmatched content-type as same as None of body. | ||
case _ => | ||
GraphQLRequest() |
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.
If we return a Task[GraphQLRequest]
, this could fail with an exception e.g. "Query was not found".
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.
Maybe fixed this.
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.
Looks good to me! Thank you~
I Implemented function (suport "query" query string as GET)
in the case of finch as details in #421
Paste the result of Test below.
curl GET query
curl POST query