Pass ServeHeaderOptions by value instead of pointer, fine tune httplib tests#36982
Merged
Conversation
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com> Agent-Logs-Url: https://github.com/go-gitea/gitea/sessions/6b6b540e-6225-4d0f-b161-4e9b562c1655
Copilot
AI
changed the title
[WIP] Refactor ServeHeaderOptions to use structs instead of pointers
refactor: use value semantics for ServeHeaderOptions parameters
Mar 25, 2026
9 tasks
lunny
approved these changes
Mar 25, 2026
bircni
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pass
ServeHeaderOptionsby value instead of pointer across all call sites — no nil-check semantics are needed and the struct is small enough that copying is fine.Changes
services/context/base.go:SetServeHeadersandServeContentacceptServeHeaderOptions(value, not pointer); internal unsafe pointer cast replaced with a clean type conversionrouters/api/packages/helper/helper.go:ServePackageFilevariadic changed from...*context.ServeHeaderOptionsto...context.ServeHeaderOptions; internal variable is now a value type&context.ServeHeaderOptions{...}→context.ServeHeaderOptions{...}Before/after at the definition level:
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.