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

ENV Variables in request highlighting #1029

Closed
NicOfNoomers opened this issue Jul 27, 2020 · 9 comments
Closed

ENV Variables in request highlighting #1029

NicOfNoomers opened this issue Jul 27, 2020 · 9 comments
Assignees
Labels
feature New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest major Important

Comments

@NicOfNoomers
Copy link

Is your feature request related to a problem? Please describe.
Trying to use environment variables is pretty difficult, and we never know if a variable is successfully attached to the request

Describe the solution you'd like
If there was some kind of checking with underline or changing text color it would be much easier to identify wrong env. variables

Describe alternatives you've considered
Insomnia Rest does smth like this, as shown in the screenshot

Additional context
Attached Screenshots
image

@AndrewBastin AndrewBastin added the feature New feature or request label Aug 4, 2020
@sukheja-varun
Copy link

I totally agree, in Insomnia it hardly took any time to figure out how env variables work but in postwoman, it is a bit difficult.
I have created an env with few variables but still not able to figure out how to make any env active.

@liyasthomas
Copy link
Member

Got it. Since envs are used inline inside an input box (URL field), it's quite hard to list / highlight registered envs from input. I tried to parse URL input with some regex to show registered envs in a tooltip but had no luck with it. Will try another method. Let me know if there's any UI wise implementation that could tackle this. May be like auto-complete for envs?

@liyasthomas liyasthomas added the major Important label Aug 20, 2020
@liyasthomas liyasthomas added good first issue Good for newcomers hacktoberfest Hacktoberfest labels Sep 2, 2020
@gordolio
Copy link

Auto-complete is a start, but a custom component that allows you to choose more than just environment variables would be better, I think. Here is an example from the program "Paw".

It auto-completes known environment variables and places them as a "badge".
Screen Shot 2020-09-10 at 8 24 45 AM

Here's an example of it grabbing the a jwt token from a login response using a jq filter.
Screen Shot 2020-09-10 at 8 39 21 AM-2

I know how I'd create something like this in React. I'd have a special input component that would have a dual renderer. One function would render how it should appear in the user-interface. The second render function would render how it should be used in a request. The underlying storable data would be an array of different types of blocks (RawStringBlock, EnvironmentVariableBlock, ResponseParsedBodyBlock, etc...). Then when you click the badge you'd have a popover for changing that particular block.

I think it could be done in a similar way in vue.

@liyasthomas
Copy link
Member

That's great input. Visually, this is something I'd in mind. Let me dig deep into this approach. Will ping you in need of any help ;)

@AndrewBastin
Copy link
Member

Umm, I am actually working on the implementation of this. Along with a overhaul of the URL parsing system. Just that all new feature work is paused for a while to work on tests and improving the stability and reliability until the Teams feature has rolled out.

@AndrewBastin AndrewBastin self-assigned this Sep 14, 2020
@AndrewBastin
Copy link
Member

Update: Environment variable highlighting is now implemented in the URL field as an Experiment. You can enable the experiment in the settings page. It is not stable yet, but it is on track to be stable soon.

Closing this issue meanwhile.

@yoerriwalstra
Copy link

I feel a bit dumb for having to ask this, but what is the syntax for using environment variables in your URLs?

I have an environment with variable base_url in it, but I can't get my requests to work with it... I couldn't find any examples showcasing this feature, so I had to guess how it should work. I read the discussion in #147 which suggested that Hoppscotch would, like Postman, support nunchucks syntax for environment variables. I've tried different variations, but without success.

Example:

GET {{ environment.base_url }}/companies
GET {{ variables.base_url }}/companies
GET {{ base_url }}/companies

@liyasthomas
Copy link
Member

liyasthomas commented Nov 20, 2020

@yoerriwalstra

Ex: <<variable_name>>

Use environment variables enclosed in double angular brackets (<<>>) anywhere in request section.

@yoerriwalstra
Copy link

Thanks for the quick reply! And the awesome work you guys are doing :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest major Important
Projects
None yet
Development

No branches or pull requests

6 participants