Skip to content

Commit

Permalink
fix panic for bad integer casting (TykTechnologies#2410)
Browse files Browse the repository at this point in the history
HardTimeout expects float64 result but  HardTimeoutMeta.Timeout is int

This  causes the panic  when calling spec.CheckSpecMatchesStatus  with
HardTimeout
  • Loading branch information
gernest authored and buger committed Aug 19, 2019
1 parent 69a6be5 commit 18c8fc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateway/reverse_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ func (p *ReverseProxy) CheckHardTimeoutEnforced(spec *APISpec, req *http.Request
_, versionPaths, _, _ := spec.Version(req)
found, meta := spec.CheckSpecMatchesStatus(req, versionPaths, HardTimeout)
if found {
intMeta := meta.(*float64)
intMeta := meta.(*int)
log.Debug("HARD TIMEOUT ENFORCED: ", *intMeta)
return true, *intMeta
return true, float64(*intMeta)
}

return false, spec.GlobalConfig.ProxyDefaultTimeout
Expand Down

0 comments on commit 18c8fc0

Please sign in to comment.