[PR #367] [MERGED] Refactor default headers to be injected dynamically #645

Closed
opened 2026-04-16 15:20:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/367
Author: @gschier
Created: 1/19/2026
Status: Merged
Merged: 1/19/2026
Merged by: @gschier

Base: mainHead: refactor-default-headers


📝 Commits (3)

  • 62bb39e Refactor default headers to be injected dynamically
  • cca3010 Deduplicate inherited headers by name
  • 0c6f054 Update migration to filter out default headers instead of replacing all

📊 Changes

13 files changed (+106 additions, -33 deletions)

View changed files

📝 crates-tauri/yaak-app/src/commands.rs (+7 -0)
📝 crates-tauri/yaak-app/src/lib.rs (+1 -0)
crates/yaak-models/migrations/20260119045146_remove-default-workspace-headers.sql (+12 -0)
📝 crates/yaak-models/src/queries/grpc_requests.rs (+2 -1)
📝 crates/yaak-models/src/queries/http_requests.rs (+2 -1)
📝 crates/yaak-models/src/queries/mod.rs (+21 -1)
📝 crates/yaak-models/src/queries/websocket_requests.rs (+2 -1)
📝 crates/yaak-models/src/queries/workspaces.rs (+24 -23)
📝 src-web/components/HeadersEditor.tsx (+12 -2)
📝 src-web/components/WorkspaceSettingsDialog.tsx (+1 -0)
📝 src-web/hooks/useInheritedHeaders.ts (+13 -4)
src-web/lib/defaultHeaders.ts (+8 -0)
📝 src-web/lib/tauri.ts (+1 -0)

📄 Description

Instead of storing default headers (User-Agent: yaak and Accept: */*) in each workspace's database record, they are now injected at request time.

Changes

  • Add default_headers() function in Rust, exposed via cmd_default_headers Tauri command
  • Update inherited headers logic to include defaults at the start of the inheritance chain
  • Show "Defaults" label in workspace settings for clarity
  • Migration cleans up workspaces that have unmodified default headers

Benefits

  • Single source of truth: Default headers defined in one place rather than duplicated in every workspace
  • Cleaner workspace data: Workspaces no longer store redundant default headers
  • Easier to modify defaults: Future changes only require updating one location
  • Better UI clarity: Workspace settings shows "Defaults" to distinguish from inherited headers

🔄 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/mountain-loop/yaak/pull/367 **Author:** [@gschier](https://github.com/gschier) **Created:** 1/19/2026 **Status:** ✅ Merged **Merged:** 1/19/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `refactor-default-headers` --- ### 📝 Commits (3) - [`62bb39e`](https://github.com/mountain-loop/yaak/commit/62bb39e3ba877ad59f65ad8381c752b9aa12c491) Refactor default headers to be injected dynamically - [`cca3010`](https://github.com/mountain-loop/yaak/commit/cca30100e4310ccd5b9b0b2e871d8b21686f7615) Deduplicate inherited headers by name - [`0c6f054`](https://github.com/mountain-loop/yaak/commit/0c6f054e54fa3a50ae5c68d25eb00ce70245ea54) Update migration to filter out default headers instead of replacing all ### 📊 Changes **13 files changed** (+106 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `crates-tauri/yaak-app/src/commands.rs` (+7 -0) 📝 `crates-tauri/yaak-app/src/lib.rs` (+1 -0) ➕ `crates/yaak-models/migrations/20260119045146_remove-default-workspace-headers.sql` (+12 -0) 📝 `crates/yaak-models/src/queries/grpc_requests.rs` (+2 -1) 📝 `crates/yaak-models/src/queries/http_requests.rs` (+2 -1) 📝 `crates/yaak-models/src/queries/mod.rs` (+21 -1) 📝 `crates/yaak-models/src/queries/websocket_requests.rs` (+2 -1) 📝 `crates/yaak-models/src/queries/workspaces.rs` (+24 -23) 📝 `src-web/components/HeadersEditor.tsx` (+12 -2) 📝 `src-web/components/WorkspaceSettingsDialog.tsx` (+1 -0) 📝 `src-web/hooks/useInheritedHeaders.ts` (+13 -4) ➕ `src-web/lib/defaultHeaders.ts` (+8 -0) 📝 `src-web/lib/tauri.ts` (+1 -0) </details> ### 📄 Description Instead of storing default headers (`User-Agent: yaak` and `Accept: */*`) in each workspace's database record, they are now injected at request time. ## Changes - Add `default_headers()` function in Rust, exposed via `cmd_default_headers` Tauri command - Update inherited headers logic to include defaults at the start of the inheritance chain - Show "Defaults" label in workspace settings for clarity - Migration cleans up workspaces that have unmodified default headers ## Benefits - **Single source of truth**: Default headers defined in one place rather than duplicated in every workspace - **Cleaner workspace data**: Workspaces no longer store redundant default headers - **Easier to modify defaults**: Future changes only require updating one location - **Better UI clarity**: Workspace settings shows "Defaults" to distinguish from inherited headers --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 15:20:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/yaak#645