MCPcopy Index your code
hub / github.com/cubefs/cubefs / ParseRequestParam

Function ParseRequestParam

objectnode/api_handler.go:80–105  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

78}
79
80func ParseRequestParam(r *http.Request) *RequestParam {
81 p := new(RequestParam)
82 p.r = r
83 p.vars = mux.Vars(r)
84 p.bucket = p.vars[ContextKeyBucket]
85 p.object = p.vars[ContextKeyObject]
86 p.accessKey = p.vars[ContextKeyAccessKey]
87 p.sourceIP = getRequestIP(r)
88 if len(p.bucket) > 0 {
89 p.resource = p.bucket
90 if len(p.object) > 0 {
91 if strings.HasPrefix(p.object, "/") {
92 p.resource = p.bucket + p.object
93 } else {
94 p.resource = p.bucket + "/" + p.object
95 }
96 }
97 }
98 p.action = GetActionFromContext(r)
99 if p.action.IsNone() {
100 p.action = ActionFromRouteName(mux.CurrentRoute(r).GetName())
101 }
102 p.apiName = strings.TrimPrefix(string(p.action), proto.OSSActionPrefix)
103
104 return p
105}
106
107func (o *ObjectNode) getVol(bucket string) (vol *Volume, err error) {
108 if bucket == "" {

Calls 5

getRequestIPFunction · 0.85
GetActionFromContextFunction · 0.85
ActionFromRouteNameFunction · 0.85
GetNameMethod · 0.65
IsNoneMethod · 0.45

Tested by

no test coverage detected