-
Notifications
You must be signed in to change notification settings - Fork 66
feature(network): Basic GraphQL support added #328
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
Conversation
|
hey @pavelperc will check the changes & get back, also, can you check if the GraphQL support can be added as capability to Ktor interceptor as well. |
Hello. In the current implementation no extra integration is needed, because graphql is detected by request body.
All business logic is located in network-core module, so it should work with ktor too. |
| ) | ||
|
|
||
| data class Response( | ||
| val request: Request, |
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.
this is an anti-pattern,
Request & Response are mutually exclusive objects.
can understand what you are trying to do here, but lets figure out a better way, than corrupting the Response class.
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.
Actually, in both ktor and okhttp lib you can access request from response instances, so I thought this is okay.
I will just delete all the logic about parsing response.
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.
yes thats right,
we have ApiCallData for that purpose only.
| } | ||
|
|
||
| data class Response( | ||
| val request: Request, |
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.
similar concern
...ns/plugins/network/core/lib/src/main/java/com/pluto/plugins/network/intercept/NetworkData.kt
Outdated
Show resolved
Hide resolved
|
Hi. Are there still unfixed issues? |
* added graphql examples * show graphql query names. * added variables * Revert "added variables" This reverts commit 4e53181. * better icon * renamed function * fixed ktlint and detekt issues. * display variables and details * fixed graphql search * removed graphql error handling * detect json by mediaType * fixed no-op
fixes #326
Hello. I added a basic GraphQL support for network plugin. It recognises POST api calls with "query" part in it and shows query name and type instead of api path in api calls list.
Also, it recognises errors in api response and paints api calls in red, even if the status code is 200.You may not like the way it is done. I thought about making a separate graphql interceptor with apollo graphql library (https://www.apollographql.com/docs/kotlin/advanced/interceptors-http), but graphql calls use http under the hood, so grapqhl calls would be duplicated in http interceptor. Also different clients use different versions of apollo library (2x, 3x, 4x), and it is a bad way to add a dependency only with one version of library. I thought it would be easier to parse raw request, rather then add an interceptor, but we can discuss and I can redo the implementation.
UPD. Image 2 (error handling) is not supported, see discussion