MCPcopy Index your code
hub / github.com/php/frankenphp / newDummyContext

Function newDummyContext

context.go:108–122  ·  view source on GitHub ↗

newDummyContext creates a fake context from a request path

(requestPath string, opts ...RequestOption)

Source from the content-addressed store, hash-verified

106
107// newDummyContext creates a fake context from a request path
108func newDummyContext(requestPath string, opts ...RequestOption) (*frankenPHPContext, error) {
109 r, err := http.NewRequestWithContext(globalCtx, http.MethodGet, requestPath, nil)
110 if err != nil {
111 return nil, err
112 }
113
114 fr, err := NewRequestWithContext(r, opts...)
115 if err != nil {
116 return nil, err
117 }
118
119 fc, _ := fromContext(fr.Context())
120
121 return fc, nil
122}
123
124// closeContext sends the response to the client
125func (fc *frankenPHPContext) closeContext() {

Callers 1

setupWorkerScriptFunction · 0.85

Calls 2

NewRequestWithContextFunction · 0.85
fromContextFunction · 0.85

Tested by

no test coverage detected