[PR #5867] fix(codegen): include User-Agent header in HAR if missing #5385

Open
opened 2026-03-17 02:50:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5867
Author: @swaraj017
Created: 2/11/2026
Status: 🔄 Open

Base: mainHead: fix-user-agent-csharp-codegen


📝 Commits (3)

  • 9958dcc fix(codegen): include User-Agent header in HAR if missing
  • b707dbc fix(codegen): remove semicolon & fix blank lines in HAR headers
  • aa62183 Merge branch 'main' into fix-user-agent-csharp-codegen

📊 Changes

1 file changed (+26 additions, -16 deletions)

View changed files

📝 packages/hoppscotch-common/src/helpers/new-codegen/har.ts (+26 -16)

📄 Description

Description

When generating C# code using the "Show Code" feature, the User-Agent header was not included. This could cause problems with servers that expect a User-Agent to be present.

Browsers automatically attach a User-Agent header, but it is not part of the request data used during HAR-based code generation. Because of this, the generated code did not include it.

This update ensures that a User-Agent header is added during HAR generation if one is not already provided in the request.


Summary by cubic

Ensures HAR includes a User-Agent header (default "Hoppscotch") when missing so generated C# requests include it and work with servers that require it (addresses #5772). Also fixes HAR header formatting and avoids duplicate User-Agent entries.

Written for commit aa62183355. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5867 **Author:** [@swaraj017](https://github.com/swaraj017) **Created:** 2/11/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-user-agent-csharp-codegen` --- ### 📝 Commits (3) - [`9958dcc`](https://github.com/hoppscotch/hoppscotch/commit/9958dcc7b5f793ade071c2f3e993d6c1ae038918) fix(codegen): include User-Agent header in HAR if missing - [`b707dbc`](https://github.com/hoppscotch/hoppscotch/commit/b707dbcd5f2ed6d55906d496b30ad9f3434fdf7a) fix(codegen): remove semicolon & fix blank lines in HAR headers - [`aa62183`](https://github.com/hoppscotch/hoppscotch/commit/aa621833555765127f21921077dfa97c283ebdf1) Merge branch 'main' into fix-user-agent-csharp-codegen ### 📊 Changes **1 file changed** (+26 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/helpers/new-codegen/har.ts` (+26 -16) </details> ### 📄 Description ### Description When generating C# code using the "Show Code" feature, the User-Agent header was not included. This could cause problems with servers that expect a User-Agent to be present. Browsers automatically attach a `User-Agent` header, but it is not part of the request data used during HAR-based code generation. Because of this, the generated code did not include it. This update ensures that a User-Agent header is added during HAR generation if one is not already provided in the request. ### Related to #5772 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Ensures HAR includes a User-Agent header (default "Hoppscotch") when missing so generated C# requests include it and work with servers that require it (addresses #5772). Also fixes HAR header formatting and avoids duplicate User-Agent entries. <sup>Written for commit aa621833555765127f21921077dfa97c283ebdf1. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5385
No description provided.