(expectedResp models.HTTPResp, canonicalizer func(string) string, ignoreEmpty bool)
| 1437 | } |
| 1438 | |
| 1439 | func 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 | |
| 1458 | func streamChunkFieldValue(chunk models.HTTPStreamChunk, key string) (string, bool) { |
| 1459 | key = strings.ToLower(strings.TrimSpace(key)) |
no test coverage detected