Skip to content

fix(api): only set content-type header when a body is sent - #91

Merged
v0l merged 1 commit into
mainfrom
fix/reinstall-content-type
Jul 29, 2026
Merged

fix(api): only set content-type header when a body is sent#91
v0l merged 1 commit into
mainfrom
fix/reinstall-content-type

Conversation

@v0l

@v0l v0l commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #90.

#req always set content-type: application/json, even when body was undefined — the server's Option<Json<ReinstallRequest>> extractor then tries to parse zero bytes as JSON and errors instead of treating it as None. Only the reinstall-with-no-image-change path hit this (no other caller sends an empty body), but the fix is in the shared request helper.

Header is now only set when a body is actually sent. Added a test exercising reinstallVm both ways (with and without image_id) against a mocked fetch, confirmed it fails on the old code and passes on the new.

bun test, bun run typecheck, bun run lint, and bun run build all pass on this branch.

@v0l
v0l merged commit 5958dbc into main Jul 29, 2026
3 checks passed
@v0l
v0l deleted the fix/reinstall-content-type branch July 30, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VM reinstall (no image change) fails: #req sends a JSON content-type on a bodyless request

1 participant