fix(kibana): send an empty object when no body is provided on POST, PUT, PATCH and DELETE - #586
Conversation
…UT, PATCH and DELETE
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts MegaLinter is graciously provided by OX Security |
There was a problem hiding this comment.
🟡 Changes recommended
Definitions without body properties remain unnormalized despite the PR’s stated guarantee.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates Kibana request construction to normalize missing mutation bodies to {}.
Changes:
- Adds empty-body handling while excluding GET, HEAD, and multipart requests.
- Adds regression tests using synthetic and real API definitions.
- Updates functional-test skip classifications.
File summaries
| File | Description |
|---|---|
src/kb/request-builder.ts |
Adds empty-body normalization. |
test/kb/request-builder.test.ts |
Covers normalization behavior and exceptions. |
codegen/functional/kb.ts |
Updates functional-test skip reasons and entries. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def.method !== 'GET' && def.method !== 'HEAD' && | ||
| !isMultipart && | ||
| Object.values(props).some((p) => p['x-found-in'] === 'body' || p['x-found-in'] === undefined) |
Kibana was interpreting an empty body as
null, and failing the request. This fix ensures non-GET requests always send an empty object instead.