MCPcopy Create free account
hub / github.com/cli/cli / describeResponse

Function describeResponse

script/ghmock/set.go:460–480  ·  view source on GitHub ↗
(name string, list []response, pos int)

Source from the content-addressed store, hash-verified

458}
459
460func 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}

Callers 1

cmdSetFunction · 0.85

Calls 3

JoinMethod · 0.80
statusMethod · 0.80
bodyBytesMethod · 0.80

Tested by

no test coverage detected