mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 17:00:54 +00:00
zero timeout means wait until resp
This commit is contained in:
parent
69fc22f0df
commit
738e22e389
@ -65,14 +65,8 @@ func createDefaultCookie() {
|
|||||||
// Overwrite default settings
|
// Overwrite default settings
|
||||||
func SetDefaultSetting(setting BeegoHttpSettings) {
|
func SetDefaultSetting(setting BeegoHttpSettings) {
|
||||||
settingMutex.Lock()
|
settingMutex.Lock()
|
||||||
defer settingMutex.Unlock()
|
|
||||||
defaultSetting = setting
|
defaultSetting = setting
|
||||||
if defaultSetting.ConnectTimeout == 0 {
|
settingMutex.Unlock()
|
||||||
defaultSetting.ConnectTimeout = 60 * time.Second
|
|
||||||
}
|
|
||||||
if defaultSetting.ReadWriteTimeout == 0 {
|
|
||||||
defaultSetting.ReadWriteTimeout = 60 * time.Second
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return *BeegoHttpRequest with specific method
|
// return *BeegoHttpRequest with specific method
|
||||||
@ -262,11 +256,11 @@ func (b *BeegoHttpRequest) PostFile(formname, filename string) *BeegoHttpRequest
|
|||||||
// it supports string and []byte.
|
// it supports string and []byte.
|
||||||
func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest {
|
func (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest {
|
||||||
switch t := data.(type) {
|
switch t := data.(type) {
|
||||||
case string:
|
case string:
|
||||||
bf := bytes.NewBufferString(t)
|
bf := bytes.NewBufferString(t)
|
||||||
b.req.Body = ioutil.NopCloser(bf)
|
b.req.Body = ioutil.NopCloser(bf)
|
||||||
b.req.ContentLength = int64(len(t))
|
b.req.ContentLength = int64(len(t))
|
||||||
case []byte:
|
case []byte:
|
||||||
bf := bytes.NewBuffer(t)
|
bf := bytes.NewBuffer(t)
|
||||||
b.req.Body = ioutil.NopCloser(bf)
|
b.req.Body = ioutil.NopCloser(bf)
|
||||||
b.req.ContentLength = int64(len(t))
|
b.req.ContentLength = int64(len(t))
|
||||||
|
Loading…
Reference in New Issue
Block a user