Skip to content

Commit

Permalink
when header is empty don't record
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoYL123 committed Mar 19, 2020
1 parent f361b10 commit 04ed0a7
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions server/handler/track_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
return
}
chain.Next(inv, func(ir *invocation.Response) error {
resp, ok := ir.Result.(*restful.Response)
if !ok {
err := cb(ir)
if err != nil {
return err
}
return nil
resp, _ := ir.Result.(*restful.Response)
err := cb(ir)
if err != nil {
return err
}
revStr := req.QueryParameter(common.QueryParamRev)
wait := req.QueryParameter(common.QueryParamWait)
Expand All @@ -78,14 +75,16 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
data.IP = iputil.ClientIP(req.Request)
data.ResponseBody = inv.Ctx.Value(common.RespBodyContextKey)
data.ResponseCode = ir.Status
data.ResponseHeader = resp.Header()
if resp != nil {
data.ResponseHeader = resp.Header()
}
data.PollingData = map[string]interface{}{
"revStr": revStr,
"wait": wait,
"project": req.HeaderParameter(v1.PathParameterProject),
"labels": req.QueryParameter("label"),
}
_, err := track.CreateOrUpdate(inv.Ctx, data)
_, err = track.CreateOrUpdate(inv.Ctx, data)
if err != nil {
openlogging.Warn("record polling detail failed" + err.Error())
err := cb(ir)
Expand Down

0 comments on commit 04ed0a7

Please sign in to comment.