fix(http): append debug request body chunks instead of overwriting#2875
Merged
tusharmath merged 2 commits intomainfrom Apr 7, 2026
Merged
fix(http): append debug request body chunks instead of overwriting#2875tusharmath merged 2 commits intomainfrom
tusharmath merged 2 commits intomainfrom
Conversation
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.
Summary
Change the HTTP debug request body writer to use append mode instead of overwrite, so that multiple streamed chunks accumulate into a single debug file rather than each chunk replacing the previous one.
Context
When debugging HTTP requests, the body is written to a file for inspection. Previously, each chunk of the request body would call
write, overwriting the file contents with only the latest chunk. For streamed or chunked request bodies, this meant only the last chunk was visible in the debug file, making it impossible to inspect the full request payload.Changes
appendmethod to theFileWriterInfratrait and all its implementations (ForgeFS,ForgeFileWriteService,ForgeInfra,ForgeRepo)writetoappend, so chunks accumulate in the fileFileWriterInfrato include the newappendmethodKey Implementation Details
The
ForgeFS::appendfunction opens the file withcreate(true)andappend(true)flags viatokio::fs::OpenOptions, ensuring the file is created on first write and subsequent writes are appended. Parent directories are created automatically before appending (consistent with the existingwritebehaviour). The HTTP layer spawns atokio::spawntask that callsappendfor every chunk, so the full body is assembled in order.Testing