MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Send

Method Send

internal/nodes/http_writer.go:854–866  ·  view source on GitHub ↗

Send 直接发送内容,并终止请求

(status int, body string)

Source from the content-addressed store, hash-verified

852
853// Send 直接发送内容,并终止请求
854func (this *HTTPWriter) Send(status int, body string) {
855 this.req.ProcessResponseHeaders(this.Header(), status)
856
857 // content-length
858 _, hasContentLength := this.Header()["Content-Length"]
859 if !hasContentLength {
860 this.Header()["Content-Length"] = []string{types.String(len(body))}
861 }
862
863 this.WriteHeader(status)
864 _, _ = this.WriteString(body)
865 this.isFinished = true
866}
867
868// SendFile 发送文件内容,并终止请求
869func (this *HTTPWriter) SendFile(status int, path string) (int64, error) {

Callers 7

getPIDMethod · 0.45
listenSockMethod · 0.45
replyFailMethod · 0.45
replyOkMethod · 0.45
replyOkDataMethod · 0.45
loopMethod · 0.45
mainFunction · 0.45

Calls 5

HeaderMethod · 0.95
WriteHeaderMethod · 0.95
WriteStringMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected