738e22e3 by JessonChan Committed by astaxie

zero timeout means wait until resp

1 parent 69fc22f0
...@@ -65,14 +65,8 @@ func createDefaultCookie() { ...@@ -65,14 +65,8 @@ func createDefaultCookie() {
65 // Overwrite default settings 65 // Overwrite default settings
66 func SetDefaultSetting(setting BeegoHttpSettings) { 66 func SetDefaultSetting(setting BeegoHttpSettings) {
67 settingMutex.Lock() 67 settingMutex.Lock()
68 defer settingMutex.Unlock()
69 defaultSetting = setting 68 defaultSetting = setting
70 if defaultSetting.ConnectTimeout == 0 { 69 settingMutex.Unlock()
71 defaultSetting.ConnectTimeout = 60 * time.Second
72 }
73 if defaultSetting.ReadWriteTimeout == 0 {
74 defaultSetting.ReadWriteTimeout = 60 * time.Second
75 }
76 } 70 }
77 71
78 // return *BeegoHttpRequest with specific method 72 // return *BeegoHttpRequest with specific method
...@@ -262,11 +256,11 @@ func (b *BeegoHttpRequest) PostFile(formname, filename string) *BeegoHttpRequest ...@@ -262,11 +256,11 @@ func (b *BeegoHttpRequest) PostFile(formname, filename string) *BeegoHttpRequest
262 // it supports string and []byte. 256 // it supports string and []byte.
263 func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest { 257 func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest {
264 switch t := data.(type) { 258 switch t := data.(type) {
265 case string: 259 case string:
266 bf := bytes.NewBufferString(t) 260 bf := bytes.NewBufferString(t)
267 b.req.Body = ioutil.NopCloser(bf) 261 b.req.Body = ioutil.NopCloser(bf)
268 b.req.ContentLength = int64(len(t)) 262 b.req.ContentLength = int64(len(t))
269 case []byte: 263 case []byte:
270 bf := bytes.NewBuffer(t) 264 bf := bytes.NewBuffer(t)
271 b.req.Body = ioutil.NopCloser(bf) 265 b.req.Body = ioutil.NopCloser(bf)
272 b.req.ContentLength = int64(len(t)) 266 b.req.ContentLength = int64(len(t))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!