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

#521 Script Code Evaluation for variables #674

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AnWeber
Copy link

@AnWeber AnWeber commented Aug 30, 2020

fixes #521
script code evalutation for variables. I tried to describe functionality in the readme.md. I hope a pull request is welcome.

@AnWeber
Copy link
Author

AnWeber commented Nov 10, 2020

hi I wanted to ask, if you missed this pull requests? I want to use the extension, but I need another authentication mechanism. For this use case I need script execution.

@Huachao
Copy link
Owner

Huachao commented Nov 10, 2020

@AnWeber thanks for your PR, I have two questions:

  1. the new script variable only works for the arrow functions
  2. how to write/express multiple-line JS code for variable value

@AnWeber
Copy link
Author

AnWeber commented Nov 10, 2020

1.to support function style methods, an extended parsing logic in scriptVariableProvider.ts is needed. I could extend PR, if requested. implemented function style syntax
2. multi line code is not supported, because of current implementation of HttpVariableProvider. To circumvent this limitation, it is possible to require external file: @authToken = {{(password) => require('logon.js')(password)}}. Implementing multi line scripts needs changes in variableProcessor.ts, that I do not want to implement in an unsolicited PR

@jhuizingh
Copy link

Ooh, this would be super helpful for a lot of currently unsupported authentication workflows and general scripting involving the REST Client. Would it be possible to merge and release this PR as-is and maybe add support for multiline scripts as a later PR?

@zigiprimo
Copy link

Awesome; This feature would be helpful when output variables may requires some parsing/manipulation, before being handled by another request as an input.

@jrussellsmyth
Copy link

This also provides a solution for #345
I would also like to see this capability asap, even without multiline support.

@AnWeber
Copy link
Author

AnWeber commented Dec 31, 2020

using module.parent is deprecated in NodeJS 14.6.0. Should I update Pull request? Please let me know if you want me to delete the pull request.

@jorelius
Copy link

This would be super useful. Any idea if this will actually be merged?

@AnWeber
Copy link
Author

AnWeber commented Jul 13, 2021

@jorelius I don't want to give you hope:-) Search for httpyac in marketplace. I made my own extension, which is mostly compatible.

@rngtng
Copy link

rngtng commented Nov 28, 2021

@AnWeber thats how I found about httpyac. When I first read this I thought ‚WTF - why did he create his own version?!‘ But looking into it, I fully understand why. Its great ❤️ Only can recommend everyone to check it out.

@fredrikhr
Copy link

Yeah, I have also converted over to httpyac. Httpyac also has built-in hooks for extending, user interaction apis for querying for inputs, etc.

@AnWeber
Copy link
Author

AnWeber commented Nov 28, 2021

why did he create his own version?!‘

I was bothered by the fact that rest-client has no scripting capability and thus cannot be developed further without changes to the extension itself. And a fork was not useful in my eyes, because to support a plugin API and a cli without using vscode types, a rewrite is necessary. And I'm trying to keep the plugin APi alive. I don't know if after 4 years of support I can still motivate myself to invest time in it. I can understand Huachao, but I think it's a shame because his idea is pretty darn good. And I would have liked it, to integrate all the changes in this extension.

@QuAzI
Copy link

QuAzI commented Sep 11, 2022

@AnWeber httpyac is interesting but where is sources and issue tracker?

@AnWeber
Copy link
Author

AnWeber commented Sep 11, 2022

@QuAzI Look at my account and the repos. I will add a link in the docs, but I did not want to move the sources to the organization. Maybe later.

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.

JavaScript code evaluation
9 participants