Rest Api from Cubejs gets mistaken as GraphQL when using both in one handler
See original GitHub issuePrerequisites
- I confirm my issue is not in the opened issues
- I confirm the Frequently Asked Questions didn’t contain the answer to my issue
Environment check
- I’m using the latest
msw
version - I’m using Node.js version 14 or higher
Node.js version
14.17.5
Reproduction repository
https://github.com/brantleyenglish/msw-test
Reproduction steps
Run yarn
then yarn test
Current behavior
Currently I am getting this error, and the mocked rest endpoint does not get populated with mock data.
console.error
[MSW] Failed to intercept a GraphQL request to "GET https://azure-bonobo.aws-us-west-2.cubecloudapp.dev/cubejs-api/v1/load": cannot parse query.
See the error message from the parser below.
Syntax Error: Expected Name, found String "measures".
This url should be parsed as a rest endpoint. This is not a graphql query.
Expected behavior
I expect the test to pass the resultSet
to return some form of data.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
GraphQL API | Cube Docs
Getting started. The Cube GraphQL API does not currently support using variables from a GraphQL client. Instead inline variables directly in the query....
Read more >Welcome to Everything.js | Everything.js
Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API. ... for the modern web. graphql/graphql-js - A reference implementation of GraphQL...
Read more >Data Visualization Dashboard using Vue.js, Cube.js ... - Morioh
js and Cube, a Headless BI and analytics APIs for building data applications. You'll also learn how you can use Apache ECharts, an...
Read more >CVE - Search Results - MITRE
An attacker can take advantage of this by using an HTTP GET request to perform actions ... In the HTTP Handler API, the...
Read more >Security Bulletin 14 Dec 2022
CVE Number Base Score Reference
CVE‑2021‑29472 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑29472
CVE‑2021‑32765 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑32765
CVE‑2021‑39317 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑39317
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
Wow, this is very cool 😮 !! Thank you for taking a look into my issue and suggesting the improvement.
Hey, @brantleyenglish. Thanks for reporting this!
I’ve posted an update on the way to tell apart GraphQL requests reliably here: https://github.com/mswjs/msw/discussions/535#discussioncomment-2504052
This really moves the discussion (and the correct solution to this issue) to the GraphQL community. I’d stay in the loop to see how I can help. I’d love to merge a fix for this in a form of relying on the
application/graphql+json
content type header.