Skip to content

Fix variablesJSONString store default for GraphQL page#593

Merged
NBTX merged 1 commit intohoppscotch:masterfrom
dihmeetree:patch-1
Feb 24, 2020
Merged

Fix variablesJSONString store default for GraphQL page#593
NBTX merged 1 commit intohoppscotch:masterfrom
dihmeetree:patch-1

Conversation

@dihmeetree
Copy link
Copy Markdown

@dihmeetree dihmeetree commented Feb 24, 2020

I don't have any variables set, and when running a mutation; I get the following error:

Error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at VueComponent._callee$ (graphql.vue?f047:505)
    at tryCatch (runtime.js?96cf:45)
    at Generator.invoke [as _invoke] (runtime.js?96cf:271)
    at Generator.prototype.<computed> [as next] (runtime.js?96cf:97)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
    at _next (asyncToGenerator.js?1da1:25)
    at eval (asyncToGenerator.js?1da1:32)
    at new Promise (<anonymous>)
    at VueComponent.eval (asyncToGenerator.js?1da1:21)

This error is caused by Postwoman trying to JSON parse an empty string, which is set as the default.
https://github.com/liyasthomas/postwoman/blob/f690ea01c4319d57ea311261c9857faf4a8f6baa/pages/graphql.vue#L505

Setting the variablesJSONString variable to the correct default ({}) fixes this issue :)

Before:
image

After:
image

I don't have any variables set, and when running a mutation; I get the following error:

```
Error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at VueComponent._callee$ (graphql.vue?f047:505)
    at tryCatch (runtime.js?96cf:45)
    at Generator.invoke [as _invoke] (runtime.js?96cf:271)
    at Generator.prototype.<computed> [as next] (runtime.js?96cf:97)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
    at _next (asyncToGenerator.js?1da1:25)
    at eval (asyncToGenerator.js?1da1:32)
    at new Promise (<anonymous>)
    at VueComponent.eval (asyncToGenerator.js?1da1:21)
```

Setting the `variablesJSONString` variable to the correct default (`{}`) fixes this issue :)
@ghost
Copy link
Copy Markdown

ghost commented Feb 24, 2020

Congratulations 🍻. DeepCode analyzed your code in 0.105 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

💬 This comment has been generated by the DeepCode bot, installed by the owner of the repository. The DeepCode bot protects your repository by detecting and commenting on security vulnerabilities or other critical issues.


☺️ If you want to provide feedback on our bot, here is how to contact us.

@dihmeetree dihmeetree changed the title Fix variables JSON string Fix variablesJSONString store default Feb 24, 2020
@dihmeetree dihmeetree changed the title Fix variablesJSONString store default Fix variablesJSONString store default for GraphQL page Feb 24, 2020
@TravisBuddy
Copy link
Copy Markdown

Hey @dmitryyankowski,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: d1c196b0-56a1-11ea-8ad8-19cca21d7143

@NBTX NBTX merged commit 6e03c8d into hoppscotch:master Feb 24, 2020
@dihmeetree dihmeetree deleted the patch-1 branch February 24, 2020 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants