[GH-ISSUE #2665] [bug]: Env variable with dash in its name doesn't work in JSON body #876

Closed
opened 2026-03-16 17:31:14 +03:00 by kerem · 7 comments
Owner

Originally created by @aaronz-vipaso on GitHub (Sep 15, 2022).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2665

Originally assigned to: @anwarulislam on GitHub.

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When I use an env variable with a dash in its name in a JSON body, the variable does not become substituted with the actual value. Even though the variable is correctly highlighted green.
2022-09-15_09-08

However when I use a env variable without dashes in its name in a JSON body, the variable becomes substituted with the actual value as expected.
2022-09-15_09-10


https://github.com/hoppscotch/hoppscotch/issues/1834
https://github.com/hoppscotch/hoppscotch/pull/1942

Steps to reproduce

  1. Create an env variable with dashes in its name
  2. Create a request with a json body which uses this env variable
  3. Send request – variable doesn't become substituted with the actual value

Environment

Production

Version

Cloud

Originally created by @aaronz-vipaso on GitHub (Sep 15, 2022). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2665 Originally assigned to: @anwarulislam on GitHub. ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior When I use an env variable with a **dash in its name** in a JSON body, the variable does not become substituted with the actual value. Even though the variable is correctly highlighted green. ![2022-09-15_09-08](https://user-images.githubusercontent.com/104493365/190339042-d7c79a60-cca1-48e2-9a6b-d410f280d522.png) However when I use a env variable without dashes in its name in a JSON body, the variable becomes substituted with the actual value as expected. ![2022-09-15_09-10](https://user-images.githubusercontent.com/104493365/190339294-9ddeb392-ad7f-41ed-9641-da256ea3660e.png) ------ https://github.com/hoppscotch/hoppscotch/issues/1834 https://github.com/hoppscotch/hoppscotch/pull/1942 ### Steps to reproduce 1. Create an env variable with dashes in its name 2. Create a request with a json body which uses this env variable 3. Send request – variable doesn't become substituted with the actual value ### Environment Production ### Version Cloud
kerem 2026-03-16 17:31:14 +03:00
Author
Owner

@liyasthomas commented on GitHub (Sep 15, 2022):

@anwarulislam can you take a look into this behaviour?

<!-- gh-comment-id:1248071593 --> @liyasthomas commented on GitHub (Sep 15, 2022): @anwarulislam can you take a look into this behaviour?
Author
Owner

@anwarulislam commented on GitHub (Sep 15, 2022):

@anwarulislam can you take a look into this behaviour?

Yeah, looking into it

<!-- gh-comment-id:1248072799 --> @anwarulislam commented on GitHub (Sep 15, 2022): > @anwarulislam can you take a look into this behaviour? Yeah, looking into it
Author
Owner

@Airomeo commented on GitHub (Nov 20, 2023):

Now in 2023. Still not fixed yet. @AndrewBastin

<!-- gh-comment-id:1818109721 --> @Airomeo commented on GitHub (Nov 20, 2023): Now in 2023. Still not fixed yet. @AndrewBastin
Author
Owner

@bvwidt commented on GitHub (Jul 9, 2024):

Is there any update regarding this issue?
I am experiencing the same with the current version (v2024.6.0).

<!-- gh-comment-id:2217837006 --> @bvwidt commented on GitHub (Jul 9, 2024): Is there any update regarding this issue? I am experiencing the same with the current version (v2024.6.0).
Author
Owner

@liyasthomas commented on GitHub (Jul 10, 2024):

@thetronjohnson can you look into this?

<!-- gh-comment-id:2220086826 --> @liyasthomas commented on GitHub (Jul 10, 2024): @thetronjohnson can you look into this?
Author
Owner

@liyasthomas commented on GitHub (Jul 10, 2024):

I can't reproduce this behavior in the latest Hoppscotch version.

@bvwidt can you try force reloading the tab (command/ctrl + shift + r) and see if the issue persists at your end?

<!-- gh-comment-id:2220136752 --> @liyasthomas commented on GitHub (Jul 10, 2024): I can't reproduce this behavior in the latest Hoppscotch version. @bvwidt can you try force reloading the tab (command/ctrl + shift + r) and see if the issue persists at your end?
Author
Owner

@bvwidt commented on GitHub (Jul 12, 2024):

You are right @liyasthomas. It works without a problem now. Sorry for the circumstances.

I have just found two other very minor problems:

  1. There is no dropdown menu in the body showing the variables when I press CTRL + SPACE unlike when using variables in the address bar.
  2. After initially entering the variable it appears read but it works.
    red-variables
<!-- gh-comment-id:2224891564 --> @bvwidt commented on GitHub (Jul 12, 2024): You are right @liyasthomas. It works without a problem now. Sorry for the circumstances. I have just found two other very minor problems: 1. There is no dropdown menu in the body showing the variables when I press `CTRL + SPACE` unlike when using variables in the address bar. 2. After initially entering the variable it appears read but it works. ![red-variables](https://github.com/user-attachments/assets/532bf5b9-8fd0-4127-8ebb-7002ab5c4e79)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#876
No description provided.