MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / buildTotallyToBody

Function buildTotallyToBody

pkg/controller/invoke.go:463–477  ·  view source on GitHub ↗
(ctx *InvokeContext, funcError, payload string, logMessage []string)

Source from the content-addressed store, hash-verified

461}
462
463func buildTotallyToBody(ctx *InvokeContext, funcError, payload string, logMessage []string) (status int) {
464 status = http.StatusOK
465 result := logToBodyResult{
466 FuncError: funcError,
467 LogResult: strings.Join(logMessage, ""),
468 Payload: payload,
469 }
470 if len(funcError) != 0 {
471 status = http.StatusInternalServerError
472 }
473 bodyData, _ := json.Marshal(result)
474 ctx.Response.SetHeader("Content-Type", "application/json; charset=utf-8")
475 ctx.Response.SetBody(bodyData)
476 return
477}
478
479func build(ctx *InvokeContext, funcError, payload string, logMessage []string) (status int) {
480 status = http.StatusOK

Callers 1

buildResponseMethod · 0.85

Calls 3

MarshalFunction · 0.92
SetHeaderMethod · 0.45
SetBodyMethod · 0.45

Tested by

no test coverage detected