MCPcopy Create free account
hub / github.com/devfeel/dotweb / WriteBlobC

Method WriteBlobC

context.go:605–616  ·  view source on GitHub ↗

WriteBlobC write (httpCode, []byte) to response

(code int, contentType string, b []byte)

Source from the content-addressed store, hash-verified

603
604// WriteBlobC write (httpCode, []byte) to response
605func (ctx *HttpContext) WriteBlobC(code int, contentType string, b []byte) error {
606 if contentType != "" {
607 ctx.response.SetContentType(contentType)
608 }
609 if ctx.IsHijack() {
610 _, err := ctx.hijackConn.WriteBlob(b)
611 return err
612 } else {
613 _, err := ctx.response.Write(code, b)
614 return err
615 }
616}
617
618// WriteJson write (httpCode, json string) to response
619// auto convert interface{} to json string

Callers 4

WriteStringCMethod · 0.95
WriteHtmlCMethod · 0.95
WriteBlobMethod · 0.95
WriteJsonBlobCMethod · 0.95

Calls 4

IsHijackMethod · 0.95
SetContentTypeMethod · 0.80
WriteBlobMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected