INNER CODE UNIT · Go

beforeServeHook

iimeta/fastapi-admin · internal/cmd/cmd.go:346

func beforeServeHook(r *ghttp.Request) {

	ctx := gctx.WithSpan(r.GetCtx(), "gctx.WithSpan")

	if traceId := r.Header.Get(consts.TRACE_ID); traceId != "" {
		ctx, _ = gtrace.WithTraceID(ctx, traceId)
	}

	r.SetCtx(ctx)
	r.SetCtxVar(consts.SESSION_HOST, r.GetHost())

	logger.Infof(r.GetCtx(), "beforeServeHook ClientIp: %s, RemoteIp: %s, IsFile: %t, URI: %s", util.GetClientIp(r), r.GetRemoteIp(), r.IsFileRequest(), r.RequestURI)

	r.Response.CORSDefault()
}

func authMiddleware(r *ghttp.Request) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…