- default config support for limt_access_speed.

* fix bug when request.Body is nil.
This commit is contained in:
gazebo
2018-10-27 12:29:27 +08:00
parent ecb04fbe72
commit 6a5afbb07f
5 changed files with 41 additions and 5 deletions

View File

@@ -85,7 +85,9 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
for {
savedBuf := new(bytes.Buffer)
request := handleRequest()
request.Body = ioutil.NopCloser(io.TeeReader(request.Body, savedBuf))
if request.Body != nil {
request.Body = ioutil.NopCloser(io.TeeReader(request.Body, savedBuf))
}
response, err := client.Do(request)
if err != nil {
baseapi.SugarLogger.Debugf("AccessPlatformAPIWithRetry client.Get return err:%v", err)