keploy / keploy/jsondiff

Bug: CompareHeaders function fails to handle missing headers properly labels: bug, test-failure

Open
#9 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
9
Forks
10
PR merge metrics
No merged PRs in 30d

Description

The CompareHeaders function currently fails to properly handle and display differences when expected headers are missing from the actual headers map.

Current Behavior
When an expected header is missing from the actual headers:

The test fails with error: "CompareHeaders() didn't properly show missing Authorization header"
The diff output doesn't properly highlight or indicate the missing header
The function may panic or produce incorrect output when trying to process missing values

Expected Behavior
When comparing headers and encountering missing values, the function should:

Clearly indicate which headers are missing in the actual headers
Mark missing headers appropriately in the diff visualization

The fails for
expected := map[string]string{
"Authorization": "Bearer token123",
"User-Agent": "test-client",
}
actual := map[string]string{
"User-Agent": "test-client",
}

Screenshot 2024-10-23 at 2 40 56 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the CompareHeaders function and reproduce the issue with the expected and actual maps shown in the report. Done means a missing Authorization header is clearly identified in the diff without a panic or incorrect output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.