Download internal/context/request.go from mikmc/StremThru: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/spaces/mikmc/StremThru/resolve/main/internal/context/request.go
- Command line
-
hf download hf://spaces/mikmc/StremThru/internal/context/request.go
-
curl -L -o request.go https://huggingface.co/spaces/mikmc/StremThru/resolve/main/internal/context/request.go
583 Bytes
| package context | |
| import ( | |
| "context" | |
| "net/http" | |
| "github.com/MunifTanjim/stremthru/store" | |
| ) | |
| type requestContextKey struct{} | |
| type RequestContext struct { | |
| Store store.Store | |
| StoreAuthToken string | |
| IsProxyAuthorized bool | |
| ProxyAuthUser string | |
| ProxyAuthPassword string | |
| } | |
| func SetRequestContext(r *http.Request) *http.Request { | |
| ctx := context.WithValue(r.Context(), requestContextKey{}, &RequestContext{}) | |
| return r.WithContext(ctx) | |
| } | |
| func GetRequestContext(r *http.Request) *RequestContext { | |
| return r.Context().Value(requestContextKey{}).(*RequestContext) | |
| } | |