| 458 | } |
| 459 | |
| 460 | func describeResponse(name string, list []response, pos int) string { |
| 461 | r := list[pos] |
| 462 | headers := make([]string, 0, len(r.Headers)) |
| 463 | for k := range r.Headers { |
| 464 | headers = append(headers, k) |
| 465 | } |
| 466 | sort.Strings(headers) |
| 467 | headerText := "no headers" |
| 468 | if len(headers) > 0 { |
| 469 | headerText = "headers " + strings.Join(headers, ", ") |
| 470 | } |
| 471 | offSchema := "" |
| 472 | if r.OffSchema { |
| 473 | offSchema = ", off-schema" |
| 474 | } |
| 475 | if r.RawBody != nil { |
| 476 | offSchema += ", raw" |
| 477 | } |
| 478 | return fmt.Sprintf("%s: response %d of %d: status %d, %s, body %d bytes%s", |
| 479 | name, pos+1, len(list), r.status(), headerText, len(r.bodyBytes()), offSchema) |
| 480 | } |