Skip to content

fix(pilot): kiota client must send uncompressed JSON request bodies - #106

Merged
ShocOne merged 1 commit into
mainfrom
fix/kiota-request-compression
Aug 4, 2026
Merged

fix(pilot): kiota client must send uncompressed JSON request bodies#106
ShocOne merged 1 commit into
mainfrom
fix/kiota-request-compression

Conversation

@ShocOne

@ShocOne ShocOne commented Aug 4, 2026

Copy link
Copy Markdown
Member

What happened

The first live run of the new go | Acceptance tests (kiota) pipeline failed on its very first create: thousandeyes_tag → bare 400 Bad Request, no detail.

Diagnosis (fully offline)

  • The serialized body is byte-for-byte identical to the create body the recorded probe evidence shows the API accepting ({"accessType","key","objectType","value"}) — the body was not the problem.
  • Capturing the client's actual wire request against a local stub showed the real cause: kiota-http-go's default middleware gzips every request body (Content-Encoding: gzip), and the ThousandEyes API refuses compressed bodies with a bare 400. The resty pilot — and every committed recording — has always spoken plain JSON.
  • The 400 carried no explanation because the OpenAPI spec declares no response body for POST /tags 400, so kiota generates no error mapping for it — a spec gap, not a client bug.

Fix

internal/client builds its adapter with the default middleware set minus request compression (GetDefaultMiddlewaresWithOptions(NewCompressionOptionsReference(false))), with a comment recording why this is load-bearing. A new wire regression test (TestUnit_Client_SendsPlainJSONBodies) pins the contract against a capture server — method, path, bearer header, Content-Type: application/json, no Content-Encoding, and the exact JSON fields — so the compression middleware returning fails a unit test instead of a live tenant run.

Verification

  • The capture test shows the exact previously-gzipped body now going out as plain JSON matching the recorded accepted shape.
  • Pilot module builds and all tests green.
  • Re-dispatch go | Acceptance tests (kiota) after merge to confirm against the live tenant.

🤖 Generated with Claude Code

The first live acceptance run of the kiota pilot failed on its very first
create with a bare 400 and no explanation. The body was not the problem --
it serialises byte-for-byte to the shape the recorded probe evidence shows
the API accepting -- the transport was: kiota-http-go's default middleware
gzips every request body and sets Content-Encoding, and the ThousandEyes
API refuses compressed bodies without saying so. The 400 carried no detail
the client could surface because the spec declares no response body for
POST /tags 400, so kiota has no error type to map it onto.

The client now builds its adapter with the default middleware minus
request compression, matching the wire behaviour every recording was
gathered under, and a wire regression test pins the contract against a
capture server: POST /v7/tags, Content-Type application/json, no
Content-Encoding, the bearer header, and the exact JSON fields -- so the
compression middleware coming back fails a unit test instead of a live
tenant run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ShocOne
ShocOne merged commit de42469 into main Aug 4, 2026
8 of 12 checks passed
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.

1 participant