MCPcopy
hub / github.com/the-open-agent/openagent / writePipeWebhookResponse

Function writePipeWebhookResponse

controllers/pipe_webhook.go:164–182  ·  view source on GitHub ↗
(c *ApiController, response *pipepkg.WebhookResponse)

Source from the content-addressed store, hash-verified

162}
163
164func writePipeWebhookResponse(c *ApiController, response *pipepkg.WebhookResponse) {
165 if response == nil {
166 c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
167 return
168 }
169
170 if response.ContentType != "" {
171 c.Ctx.Output.Header("Content-Type", response.ContentType)
172 }
173 statusCode := response.StatusCode
174 if statusCode == 0 {
175 statusCode = http.StatusOK
176 }
177
178 c.Ctx.ResponseWriter.WriteHeader(statusCode)
179 if len(response.Body) > 0 {
180 _, _ = c.Ctx.ResponseWriter.Write(response.Body)
181 }
182}
183
184type pipeSSERecorder struct {
185 header http.Header

Callers 2

ChatWebhookVerifyMethod · 0.85
ChatWebhookMethod · 0.85

Calls 3

WriteHeaderMethod · 0.45
HeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected