kratos请求
HTTP
获取原始http请求信息
import (
khttp "github.com/go-kratos/kratos/v2/transport/http"
)
hr, ok := khttp.RequestFromServerContext(ctx)
if !ok {
return nil, errors.New("get http request failed")
}
import (
khttp "github.com/go-kratos/kratos/v2/transport/http"
)
hr, ok := khttp.RequestFromServerContext(ctx)
if !ok {
return nil, errors.New("get http request failed")
}