[GH-ISSUE #1979] [bug]: Generate code throws error for some language #637

Closed
opened 2026-03-16 16:28:11 +03:00 by kerem · 5 comments
Owner

Originally created by @devblin on GitHub (Nov 28, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1979

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Current behavior

Currently, I am getting following, without any code for NodeJs Axios code generator language.

  • PRODUCTION:
    prod-hoppscotch

  • DEVELOPMENT:
    dev

Expected behavior

image

Steps to reproduce

  1. Go to https://hoppscotch.io
  2. With default endpoint, click on
    image
  3. Choose language NodeJ Axios

Environment

Production

Version

Cloud

Originally created by @devblin on GitHub (Nov 28, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1979 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior **Current behavior** --------------------------- Currently, I am getting following, without any code for **NodeJs Axios** code generator language. - **PRODUCTION:** ![prod-hoppscotch](https://user-images.githubusercontent.com/55559527/143735020-42046fca-7128-40a4-ad8d-c8ba3a6d1e78.png) - **DEVELOPMENT:** ![dev](https://user-images.githubusercontent.com/55559527/143735065-bdc8275f-a7c4-4815-873d-83f76d9b9c74.png) **Expected behavior** ----------------------------- ![image](https://user-images.githubusercontent.com/55559527/143735118-14db5cfd-b70c-41ce-bbf3-799f293bfdda.png) ### Steps to reproduce 1. Go to https://hoppscotch.io 2. With default endpoint, click on ![image](https://user-images.githubusercontent.com/55559527/143735150-df475e9f-06d4-4d80-92d0-d6506a6ae108.png) 3. Choose language **NodeJ Axios** ### Environment Production ### Version Cloud
kerem 2026-03-16 16:28:11 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@devblin commented on GitHub (Nov 28, 2021):

@liyasthomas , I have checked the code-base, and found similar error for few more generators. And, I tried fixing NodeJs Axios one in local environment, it's working fine. If you can confirm the bug, I would like to submit a PR for this issue.

<!-- gh-comment-id:981001361 --> @devblin commented on GitHub (Nov 28, 2021): @liyasthomas , I have checked the code-base, and found similar error for few more generators. And, I tried fixing **NodeJs Axios** one in local environment, it's working fine. If you can confirm the bug, I would like to submit a PR for this issue.
Author
Owner

@liyasthomas commented on GitHub (Nov 28, 2021):

Hi @devblin, appreciate your interest in contributing to Hoppscotch. Feel free to open a PR and we'll take a look into it.

<!-- gh-comment-id:981003760 --> @liyasthomas commented on GitHub (Nov 28, 2021): Hi @devblin, appreciate your interest in contributing to Hoppscotch. Feel free to open a PR and we'll take a look into it.
Author
Owner

@devblin commented on GitHub (Nov 28, 2021):

@liyasthomas , For methods other than GET, the contentType and requestBody could be null, so in null cases, can we have placeholders for contentType as "REQUEST_CONTENT_TYPE" and similar for requestBody in the generated code?

<!-- gh-comment-id:981089064 --> @devblin commented on GitHub (Nov 28, 2021): @liyasthomas , For methods other than GET, the **contentType** and **requestBody** could be null, so in **null** cases, can we have placeholders for **contentType** as **"REQUEST_CONTENT_TYPE"** and similar for **requestBody** in the generated code?
Author
Owner

@liyasthomas commented on GitHub (Nov 28, 2021):

Can we omit attributes such as body and content-type that has a possible null value? And only append to the generated code if it's not a null. A null check would be enough.

<!-- gh-comment-id:981090293 --> @liyasthomas commented on GitHub (Nov 28, 2021): Can we omit attributes such as `body` and `content-type` that has a possible `null` value? And only append to the generated code if it's not a null. A null check would be enough.
Author
Owner

@devblin commented on GitHub (Nov 28, 2021):

Yeah, sure I will make changes handling nulls and append non-null attributes.

<!-- gh-comment-id:981091671 --> @devblin commented on GitHub (Nov 28, 2021): Yeah, sure I will make changes handling nulls and append non-null attributes.
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#637
No description provided.