(tc models.HTTPReq)
| 2590 | } |
| 2591 | |
| 2592 | func MakeCurlCommand(tc models.HTTPReq) string { |
| 2593 | curl := fmt.Sprintf("curl --request %s \\\n", string(tc.Method)) |
| 2594 | curl = curl + fmt.Sprintf(" --url %s \\\n", tc.URL) |
| 2595 | header := ToHTTPHeader(tc.Header) |
| 2596 | |
| 2597 | for k, v := range ToYamlHTTPHeader(header) { |
| 2598 | if k != "Content-Length" { |
| 2599 | curl = curl + fmt.Sprintf(" --header '%s: %s' \\\n", k, v) |
| 2600 | } |
| 2601 | } |
| 2602 | if len(tc.Form) > 0 { |
| 2603 | for _, form := range tc.Form { |
| 2604 | key := form.Key |
| 2605 | if len(form.Values) == 0 { |
| 2606 | continue |
| 2607 | } |
| 2608 | value := form.Values[0] |
| 2609 | curl = curl + fmt.Sprintf(" --form '%s=%s' \\\n", key, value) |
| 2610 | } |
| 2611 | } else if tc.Body != "" { |
| 2612 | curl = curl + fmt.Sprintf(" --data %s", strconv.Quote(tc.Body)) |
| 2613 | } |
| 2614 | return curl |
| 2615 | } |
| 2616 | |
| 2617 | func ReadSessionIndices(path string, Logger *zap.Logger) ([]string, error) { |
| 2618 | indices := []string{} |
no test coverage detected