mirror of
https://github.com/openziti/ziti.git
synced 2026-09-23 02:53:33 +00:00
31 lines
648 B
Go
31 lines
648 B
Go
package env
|
|
|
|
import (
|
|
"bytes"
|
|
"github.com/openziti/edge/controller/response"
|
|
"github.com/openziti/edge/eid"
|
|
"io"
|
|
"net/http"
|
|
)
|
|
|
|
func NewRequestContext(rw http.ResponseWriter, r *http.Request) *response.RequestContext {
|
|
rid := eid.New()
|
|
|
|
body, _ := io.ReadAll(r.Body)
|
|
r.Body = io.NopCloser(bytes.NewReader(body))
|
|
|
|
requestContext := &response.RequestContext{
|
|
Id: rid,
|
|
ResponseWriter: rw,
|
|
Request: r,
|
|
Body: body,
|
|
Identity: nil,
|
|
ApiSession: nil,
|
|
ActivePermissions: []string{},
|
|
}
|
|
|
|
requestContext.Responder = response.NewResponder(requestContext)
|
|
|
|
return requestContext
|
|
}
|