MCPcopy
hub / github.com/mudler/LocalAI / Write

Method Write

core/http/middleware/node_header_test.go:29–36  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

27}
28
29func (o *orderedWriter) Write(b []byte) (int, error) {
30 // Snapshot the X-LocalAI-Node header value AT THE INSTANT the underlying
31 // writer is asked to commit bytes. This is what real HTTP clients
32 // effectively observe: anything set on the header map AFTER this point
33 // would be silently dropped.
34 o.events = append(o.events, "write:node="+o.Header().Get(NodeHeaderName))
35 return o.ResponseWriter.Write(b)
36}
37
38func (o *orderedWriter) Flush() {
39 o.events = append(o.events, "flush:node="+o.Header().Get(NodeHeaderName))

Callers 1

Calls 2

HeaderMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected