Files
zeekay 241625e7d9 rename: ziti → zt across all paths
- Repo names: ziti-* → zt-*
- Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt
- Docker images: hanzozt/ziti-* → hanzozt/zt-*
- C/Java/JS symbols: ziti_* → zt_*
- File and directory names updated
2026-02-18 18:34:19 -08:00

32 lines
667 B
Go

package env
import (
"bytes"
"io"
"net/http"
"github.com/hanzozt/zt/v2/common/eid"
"github.com/hanzozt/zt/v2/controller/response"
)
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: map[string]struct{}{},
}
requestContext.Responder = response.NewResponder(requestContext)
return requestContext
}