MCPcopy Index your code
hub / github.com/zalando/skipper / convertDebugInfo

Function convertDebugInfo

proxy/debug.go:75–122  ·  view source on GitHub ↗
(d *debugInfo)

Source from the content-addressed store, hash-verified

73}
74
75func convertDebugInfo(d *debugInfo) debugDocument {
76 doc := debugDocument{}
77 if d.route != nil {
78 doc.RouteId = d.route.Id
79 doc.Route = d.route.String()
80 doc.Filters = d.route.Filters
81 doc.Predicates = d.route.Predicates
82 }
83
84 var requestBody io.Reader
85 if d.incoming == nil {
86 log.Error("[debug response] missing incoming request")
87 } else {
88 doc.Incoming = convertRequest(d.incoming)
89 requestBody = d.incoming.Body
90 }
91
92 if d.outgoing != nil {
93 doc.Outgoing = convertRequest(d.outgoing)
94
95 // if there is an outgoing request, use the body from there
96 requestBody = d.outgoing.Body
97 }
98
99 if requestBody != nil {
100 doc.RequestBody, doc.RequestErr = convertBody(requestBody)
101 }
102
103 if d.response != nil {
104 if d.response.StatusCode != 0 || len(d.response.Header) != 0 {
105 doc.ResponseMod = &debugResponseMod{Header: d.response.Header}
106 if d.response.StatusCode != 0 {
107 s := d.response.StatusCode
108 doc.ResponseMod.Status = &s
109 }
110 }
111
112 if d.response.Body != nil {
113 doc.ResponseModBody, doc.ResponseModErr = convertBody(d.response.Body)
114 }
115 }
116
117 if d.err != nil {
118 doc.ProxyError = d.err.Error()
119 }
120
121 return doc
122}
123
124func dbgResponse(w http.ResponseWriter, d *debugInfo) {
125 w.Header().Set("Content-Type", "application/json")

Callers 2

dbgResponseFunction · 0.85
TestDebugFunction · 0.85

Calls 4

convertRequestFunction · 0.85
convertBodyFunction · 0.85
StringMethod · 0.65
ErrorMethod · 0.65

Tested by 1

TestDebugFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…