Skip to content

fix: fail an API body or header contains check whose ${VAR} is blank - #863

Merged
HappyDevs1 merged 7 commits into
mainfrom
fix/blank-api-contains
Nov 23, 2026
Merged

HappyDevs1 merged 7 commits into
mainfrom
fix/blank-api-contains

Conversation

@HappyDevs1

Copy link
Copy Markdown
Collaborator

Includes #859 and #860, because it uses #860's blank_refs helper. Merge those first, and this PR's diff drops to its own commit. It doesn't depend on #862.

Problem

assert_api with body_contains: ${ORDER_ID} and ORDER_ID empty checks text.contains(""), which is always true. header_contains is the same. The step still checks the status (2xx by default) and any body_json / equals, so a blank value quietly turns "the response mentions this order" into "the server answered 200". #837 covered page checks but not these.

Fix

  • Replay: before probing, check_assertion refuses a blank body_contains or header_contains, using fix: fail a check or condition whose ${VAR} resolves to blank #860's blank_expectation.
  • Record: the same check, through refuse_blank, so the failure is a missing_value.
  • docs/trace-format.md lists them next to the other blank-value refusals.

Tests

an_api_body_check_whose_reference_is_blank_fails_by_name: a local server answers 200 with {"order":"A-1"}. The flow records with the needle set, replay fails the step by name once it's blank, and recording with it blank is refused.

Not built locally (no disk); CI is the first compile.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 05:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@HappyDevs1
HappyDevs1 merged commit ccc6c23 into main Nov 23, 2026
13 checks passed
@HappyDevs1
HappyDevs1 deleted the fix/blank-api-contains branch November 23, 2026 05:46
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.

2 participants