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

feature request: custom variables #56

Closed
albertywu opened this issue Jan 5, 2017 · 7 comments
Closed

feature request: custom variables #56

albertywu opened this issue Jan 5, 2017 · 7 comments

Comments

@albertywu
Copy link

This is amazing, thanks for creating!

One thing that would be really useful for me is custom variables. I'd like to be able to do something like:

// $authToken: abc123
POST http://foo.com/bar
Authorization: {{ $authToken }}

###

POST http://foo.com/baz
Authorization: {{ $authToken }}

###

POST http://foo.com/moo
Authorization: {{ $authToken }}

Basically, allows me to specify in a single place a dynamic custom variable. Curious what your thoughts are on this. Thanks!

@Huachao
Copy link
Owner

Huachao commented Jan 6, 2017

@albertywu thanks for your suggestions and it's already mentioned in #22 , but I still want to keep this issue, and make this as a new place to discuss this feature. And I am still considering the design of the custom variables, and would like to discuss with you about some questions.

  1. What's the scope of the custom variables?
    In your design, the custom variables are file level, that means the custom variables are defined and used in current http file. However, do we need to reuse cross the files, that means make it as a global level? Or do we need to introduce the Environment concept in tools like Postman, and with that, user can switch value for same variable in different environments like production and sandbox.

  2. How to create/update/delete/get(CRUD) the custom variables?
    This question is related to question 1. If just implemented the custom variables in file scope, that seems easy, user just need to define all the variables they need in the http file, and they can meet the CRUD requirement easily. But if we defined in global scope, or environment scope, do we just let user create custom variables in the vscode setting file, and they can view and update the variables in the setting file directly. Or we need to be more user friendly, like adding some dialogs to CRUD environments and variables.

Do you have any suggestions or feedback? And I am also waiting for everyone's feedback, and we can discuss here.

@albertywu
Copy link
Author

hi @Huachao!

Environment concept would be better I think, as the main variable that interests me is an auth token that is more of a global-level variable. Custom variables in the vscode setting file sounds good to me.


One other feedback - I noticed that for large json responses (10MB), the plugin becomes unresponsive when making the request. I verified that on the command line, I can get a formatted json response in < 3 seconds using the following on the command-line:

curl <url> | jq . using the jq binary.

so I've verified that the issue is not network latency.

Any way we can support large JSON responses in a reasonably fast manner?

@Huachao
Copy link
Owner

Huachao commented Jan 7, 2017

@albertywu nice catch for the poor performance for large response, the reason is that I use highlight.js to highlight the http response, it will take some time to complete render the http response, I will investigate how to improve the performance

@Huachao
Copy link
Owner

Huachao commented Jan 10, 2017

@albertywu I've implemented as we discussed, and will publish a new version ASAP, so that you can have a try and give me some suggestions and feedback

@Huachao
Copy link
Owner

Huachao commented Jan 15, 2017

@albertywu you can try the custom environment and variable feature in latest version 0.12.0, thanks for your feedback and suggestion 😄

@jd987
Copy link

jd987 commented Jan 16, 2017

Very nice!!!

@albertywu
Copy link
Author

👏 thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants