REST query is mistaken for GraphQL query and can't be intercepted (throws an error)
See original GitHub issueEnvironment
Name | Version |
---|---|
msw | 0.28.2 |
browser | Chrome |
OS | Mac OS X Catalina |
Request handlers
no request handler for the following rest request
https://api.dev/artists?query=Petit+Biscuit&page=0&limit=5&workspaceId=ce54f030-2191-40b1-8b2a-cd5167e9ec5f
Actual request
const results = await Axios.get('/artists', {
params: {
query,
page,
limit,
workspaceId,
onlyBelieveArtists,
},
});
Current behavior
Browser console throws an error :
[MSW] Failed to intercept a GraphQL request to “GET https://api.dev/artists”: cannot parse query. See the error message from the parser below.
Expected behavior
no error shoud be thrown as it is not a GraphQL request
this happens in
parseGraphQLRequest
method
seemingly because it relies on the presence of a query param to start and parse the query
should this method even be called? maybe it should as no rest handler is provided it also tries to find a graphQL handler
thanks for any input on this
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Rest Api from Cubejs gets mistaken as GraphQL when using ...
Pros: Ambiguous REST requests will not throw an error. The underlying request matching logic will continue as if the request is not GraphQL...
Read more >Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ. OPERATION_RESOLUTION_FAILURE. The...
Read more >Top GraphQL Errors and How to fix them
Top GraphQL Errors and How to Fix them. Error handling in GraphQL is different on both server and client side tooling.
Read more >Changelog - Cypress Documentation
Cypress now throws an error if any Cypress commands are invoked from inside ... The cy.request() command now uses querystringify to stringify &...
Read more >Middlewares and guards - TypeGraphQL
Middlewares have also an ability to intercept the result of resolver execution. ... You can also throw error in the middleware if the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks,
makes sense if I turn the logging into a throwing
I’ll try and open a PR by the end of the week 😃
We can try to
parseGraphQLRequest
call in theonUnhandledRequest
function in something likemaybe
ortryCatch
custom function that would silence any exceptions thrown.Thank you for your support!