Skip to content

Commit

Permalink
fix(api-gateway): Unexpected token u in JSON at position 0 at JSON.parse
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Jun 14, 2019
1 parent e9cee45 commit f95cea8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cubejs-api-gateway/index.js
Expand Up @@ -237,7 +237,7 @@ class ApiGateway {
initApp(app) {
app.get(`${this.basePath}/v1/load`, this.checkAuthMiddleware, (async (req, res) => {
try {
if (!req.query.query) {
if (!req.query.query || req.query.query === 'undefined') {
throw new UserError(`query param is required`);
}
const query = JSON.parse(req.query.query);
Expand Down Expand Up @@ -283,7 +283,7 @@ class ApiGateway {

app.get(`${this.basePath}/v1/sql`, this.checkAuthMiddleware, (async (req, res) => {
try {
if (!req.query.query) {
if (!req.query.query || req.query.query === 'undefined') {
throw new UserError(`query param is required`);
}
const query = JSON.parse(req.query.query);
Expand Down

0 comments on commit f95cea8

Please sign in to comment.