AnWeber / vscode-httpyac

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=anweber.vscode-httpyac
MIT License
237 stars 20 forks source link

Possible bug with inputs #190

Closed Gxmadix closed 1 year ago

Gxmadix commented 1 year ago

Hello, I am having an issue with the vscode extension recently, saw it this morning.

ERROR: SyntaxError - Unexpected identifier
/home/user/Desktop/projects/private/nearvibz/api/http/auth.http:12
exports.$result = ($input email value? $value: test@email.com);})()
                          ^^^^^

SyntaxError: Unexpected identifier
    at new Script (node:vm:100:7)
    at createScript (node:vm:257:10)
    at Object.runInContext (node:vm:288:10)
    at RY (/home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:199:2130)
    at lHe (/home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:199:2793)
    at /home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:199:6040
    at Mc (/home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:195:33681)
    at Object.H1r [as action] (/home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:199:6005)
    at z7e.trigger (/home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:1:5121)
    at La (/home/user/.vscode/extensions/anweber.vscode-httpyac-6.4.0/dist/extension.js:195:19093)

The http request is simple input email and password

@AuthUrl = {{host}}/auth

### SignIn
# @name authSignin
# @description sign-in to get a token
@email = {{ $input email value? $value: test@email.com }}
@password = {{ $password password! $value: Password12. }}
POST {{AuthUrl}}/signin HTTP/{{httpVersion}}

{
  "email": "{{email}}",
  "password": "{{password}}"
}

This same request works fine with cli, but not with vscode extension. I am using the last version of the extension and tried using httpyac 6.1.0 and 6.4.0 I think it is related to the input fields, because I can check my server status, correctly since it doesn't ask any input.

AnWeber commented 1 year ago

I'll fix it in a minute. I extended @input so that you can suppress further queries after the first input. In doing so, I unfortunately introduced an error into the regex.

Gxmadix commented 1 year ago

Thanks @AnWeber that's fixed