MCPcopy Index your code
hub / github.com/keploy/keploy / extractExpectedRawQueue

Function extractExpectedRawQueue

pkg/util.go:1439–1456  ·  view source on GitHub ↗
(expectedResp models.HTTPResp, canonicalizer func(string) string, ignoreEmpty bool)

Source from the content-addressed store, hash-verified

1437}
1438
1439func extractExpectedRawQueue(expectedResp models.HTTPResp, canonicalizer func(string) string, ignoreEmpty bool) []string {
1440 if len(expectedResp.StreamBody) == 0 {
1441 return nil
1442 }
1443 queue := make([]string, 0, len(expectedResp.StreamBody))
1444 for _, chunk := range expectedResp.StreamBody {
1445 raw, ok := streamChunkFieldValue(chunk, "raw")
1446 if !ok {
1447 continue
1448 }
1449 raw = canonicalizer(raw)
1450 if ignoreEmpty && raw == "" {
1451 continue
1452 }
1453 queue = append(queue, raw)
1454 }
1455 return queue
1456}
1457
1458func streamChunkFieldValue(chunk models.HTTPStreamChunk, key string) (string, bool) {
1459 key = strings.ToLower(strings.TrimSpace(key))

Callers 2

compareNDJSONStreamFunction · 0.85
comparePlainTextStreamFunction · 0.85

Calls 1

streamChunkFieldValueFunction · 0.85

Tested by

no test coverage detected