[GH-ISSUE #1197] Javascript's code generation not working with body #413

Closed
opened 2026-03-16 15:12:08 +03:00 by kerem · 1 comment
Owner

Originally created by @LuisMayo on GitHub (Sep 29, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1197

Originally assigned to: @liyasthomas on GitHub.

Describe the bug
When trying to generate JS code for an HTTP method which requires a body (PUT-POST-PATCH) the code generation won't work. It won't change the content of the output generated code text-area.
In case JS was the latest selected method the "generate code" window won't even open

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://hoppscotch.io/
  2. Change HTTP method to any of the described(like POST)
  3. Click on "show the code" to open the code generator
  4. Select any of the two JavaScript generators, you'll realize the textarea's content didn't change
  5. (Optional) Close the code generation tool and try opening it again, it won't work unless you change back to a body-less method(like GET)

Expected behavior
I'd expect it to show the generated code, and even in the case it fails try not to block the code generation window from appearing again

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: MS Edge (chromium)
  • Version: 85.0.564.63

Additional context
I really like this tool, keep the good job!

Originally created by @LuisMayo on GitHub (Sep 29, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1197 Originally assigned to: @liyasthomas on GitHub. **Describe the bug** When trying to generate JS code for an HTTP method which requires a body (PUT-POST-PATCH) the code generation won't work. It won't change the content of the output generated code text-area. In case JS was the latest selected method the "generate code" window won't even open **To Reproduce** Steps to reproduce the behavior: 1. Go to https://hoppscotch.io/ 2. Change HTTP method to any of the described(like POST) 3. Click on "show the code" to open the code generator 4. Select any of the two JavaScript generators, you'll realize the textarea's content didn't change 5. (Optional) Close the code generation tool and try opening it again, it won't work unless you change back to a body-less method(like GET) **Expected behavior** I'd expect it to show the generated code, and even in the case it fails try not to block the code generation window from appearing again **Screenshots** ![image](https://user-images.githubusercontent.com/20229636/94545231-91187000-024c-11eb-9622-20f868f6fa59.png) **Desktop (please complete the following information):** - OS: Windows 10 - Browser: MS Edge (chromium) - Version: 85.0.564.63 **Additional context** I really like this tool, keep the good job!
kerem 2026-03-16 15:12:08 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@liyasthomas commented on GitHub (Sep 29, 2020):

This issues was introduced by latest updates in codegen. An utility function import has been skipped by mistake. Pushing a fix now.

<!-- gh-comment-id:700889882 --> @liyasthomas commented on GitHub (Sep 29, 2020): This issues was introduced by latest updates in codegen. An utility function import has been skipped by mistake. Pushing a fix now.
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#413
No description provided.