[PR #3966] [MERGED] fix: use proper values for addTo field when auth type is api-key #4616

Closed
opened 2026-03-17 02:08:18 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3966
Author: @amk-dev
Created: 4/8/2024
Status: Merged
Merged: 4/16/2024
Merged by: @AndrewBastin

Base: release/2024.3.1Head: fix/api-key-addTo-values


📝 Commits (4)

  • c087279 fix: add a v4 for rest schema with constant addTo values
  • dd6d8c8 fix: add a v4 for graphql schema with constant addTo values
  • 2e30e35 chore: use i18n values for pass by field
  • 5650b55 chore: add i18n values

📊 Changes

12 files changed (+182 additions, -30 deletions)

View changed files

📝 packages/hoppscotch-cli/src/utils/pre-request.ts (+2 -2)
📝 packages/hoppscotch-common/locales/en.json (+2 -0)
📝 packages/hoppscotch-common/src/components/graphql/Headers.vue (+1 -1)
📝 packages/hoppscotch-common/src/components/http/authorization/ApiKey.vue (+15 -9)
📝 packages/hoppscotch-common/src/helpers/graphql/connection.ts (+2 -2)
📝 packages/hoppscotch-common/src/helpers/import-export/import/openapi.ts (+3 -3)
📝 packages/hoppscotch-common/src/helpers/import-export/import/postman.ts (+2 -2)
📝 packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts (+1 -1)
📝 packages/hoppscotch-data/src/graphql/index.ts (+6 -4)
packages/hoppscotch-data/src/graphql/v/4.ts (+71 -0)
📝 packages/hoppscotch-data/src/rest/index.ts (+8 -6)
packages/hoppscotch-data/src/rest/v/4.ts (+69 -0)

📄 Description

FIXES HFE-466
Closes #3963

Changes

Previously when the auth type was api-key, the addTo field values where "Headers" or "Query params", and the type was a string.

This PR updates the addTo field to be an enum with the values HEADERS and QUERY_PARAMS. this is consistent with the OAuth addTo values, and also allows the type system to catch bugs that were previously not caught because any string value was accepted as a valid addTo value.

The issue #3963 is coming from this inconsistency, and this PR fixes it.

We could have kept the "Headers" and "Query params" and updated some checks. but i think this is a good time to make the values consistent and better typed, hence this PR.


🔄 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/3966 **Author:** [@amk-dev](https://github.com/amk-dev) **Created:** 4/8/2024 **Status:** ✅ Merged **Merged:** 4/16/2024 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2024.3.1` ← **Head:** `fix/api-key-addTo-values` --- ### 📝 Commits (4) - [`c087279`](https://github.com/hoppscotch/hoppscotch/commit/c0872794f1c806865e6bedaec9527436588bb105) fix: add a v4 for rest schema with constant addTo values - [`dd6d8c8`](https://github.com/hoppscotch/hoppscotch/commit/dd6d8c892e9fed6bce1e548c4e3882d6ccc24d74) fix: add a v4 for graphql schema with constant addTo values - [`2e30e35`](https://github.com/hoppscotch/hoppscotch/commit/2e30e35fe556155a0a005ea87100e9c1e37e0724) chore: use i18n values for pass by field - [`5650b55`](https://github.com/hoppscotch/hoppscotch/commit/5650b5537b370da46755045072c4b1c630e7533f) chore: add i18n values ### 📊 Changes **12 files changed** (+182 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-cli/src/utils/pre-request.ts` (+2 -2) 📝 `packages/hoppscotch-common/locales/en.json` (+2 -0) 📝 `packages/hoppscotch-common/src/components/graphql/Headers.vue` (+1 -1) 📝 `packages/hoppscotch-common/src/components/http/authorization/ApiKey.vue` (+15 -9) 📝 `packages/hoppscotch-common/src/helpers/graphql/connection.ts` (+2 -2) 📝 `packages/hoppscotch-common/src/helpers/import-export/import/openapi.ts` (+3 -3) 📝 `packages/hoppscotch-common/src/helpers/import-export/import/postman.ts` (+2 -2) 📝 `packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts` (+1 -1) 📝 `packages/hoppscotch-data/src/graphql/index.ts` (+6 -4) ➕ `packages/hoppscotch-data/src/graphql/v/4.ts` (+71 -0) 📝 `packages/hoppscotch-data/src/rest/index.ts` (+8 -6) ➕ `packages/hoppscotch-data/src/rest/v/4.ts` (+69 -0) </details> ### 📄 Description FIXES HFE-466 Closes #3963 **Changes** Previously when the auth type was `api-key`, the `addTo` field values where "Headers" or "Query params", and the type was a string. This PR updates the `addTo` field to be an enum with the values `HEADERS` and `QUERY_PARAMS`. this is consistent with the OAuth `addTo` values, and also allows the type system to catch bugs that were previously not caught because any string value was accepted as a valid `addTo` value. The issue [#3963](https://github.com/hoppscotch/hoppscotch/issues/3963) is coming from this inconsistency, and this PR fixes it. We could have kept the "Headers" and "Query params" and updated some checks. but i think this is a good time to make the values consistent and better typed, hence this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:08:18 +03:00
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#4616
No description provided.