MCPcopy
hub / github.com/keploy/keploy / sprintDiffHeader

Function sprintDiffHeader

pkg/matcher/utils.go:1074–1086  ·  view source on GitHub ↗

* * Returns a nice diff table where the left is the expect and the right * is the actual. each entry in expect and actual will contain the key * and the corresponding value. */

(expect, actual map[string]string)

Source from the content-addressed store, hash-verified

1072 * and the corresponding value.
1073 */
1074func sprintDiffHeader(expect, actual map[string]string) string {
1075 diff := jsonDiff.CompareHeaders(expect, actual)
1076
1077 // If both sides render to nothing, skip the row entirely.
1078 if isBlankPair(diff.Expected, diff.Actual) {
1079 return ""
1080 }
1081
1082 if len(diff.Expected) > maxLineLength || len(diff.Actual) > maxLineLength {
1083 return expectActualTable(diff.Expected, diff.Actual, "header", false) // Don't centerize
1084 }
1085 return expectActualTable(diff.Expected, diff.Actual, "header", true)
1086}
1087
1088/*
1089 * Returns a nice diff table where the left is the expect and the right

Callers 1

RenderMethod · 0.85

Calls 2

isBlankPairFunction · 0.85
expectActualTableFunction · 0.85

Tested by

no test coverage detected