Skip to content
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

Fix variablesJSONString store default for GraphQL page #593

Merged
merged 1 commit into from
Feb 24, 2020
Merged

Fix variablesJSONString store default for GraphQL page #593

merged 1 commit into from
Feb 24, 2020

Conversation

dihmeetree
Copy link
Contributor

@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

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

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