mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
sync
This commit is contained in:
15
response.go
15
response.go
@@ -246,7 +246,7 @@ func (obj *Response) SetContent(val []byte) {
|
||||
|
||||
// return content with []byte
|
||||
func (obj *Response) Content() []byte {
|
||||
if !obj.IsWebSocket() && !obj.IsSSE() {
|
||||
if obj.webSocket == nil && obj.sse == nil {
|
||||
obj.ReadBody()
|
||||
}
|
||||
return obj.content
|
||||
@@ -305,19 +305,6 @@ func (obj *Response) Body() io.ReadCloser {
|
||||
return obj.response.Body
|
||||
}
|
||||
|
||||
// return true if response is stream
|
||||
func (obj *Response) IsStream() bool {
|
||||
return obj.option.Stream
|
||||
}
|
||||
|
||||
// return true if response is other stream
|
||||
func (obj *Response) IsWebSocket() bool {
|
||||
return obj.webSocket != nil
|
||||
}
|
||||
func (obj *Response) IsSSE() bool {
|
||||
return obj.sse != nil
|
||||
}
|
||||
|
||||
// read body
|
||||
func (obj *Response) ReadBody() (err error) {
|
||||
obj.readBodyLock.Lock()
|
||||
|
||||
Reference in New Issue
Block a user