mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
sync
This commit is contained in:
24
requests.go
24
requests.go
@@ -346,22 +346,20 @@ func (obj *Client) request(ctx *Response) (err error) {
|
|||||||
if ctx.Body() != nil {
|
if ctx.Body() != nil {
|
||||||
ctx.body = ctx.Body().(*wrapBody)
|
ctx.body = ctx.Body().(*wrapBody)
|
||||||
}
|
}
|
||||||
if ctx.StatusCode() != 101 {
|
if encoding := ctx.ContentEncoding(); encoding != "" {
|
||||||
if encoding := ctx.ContentEncoding(); encoding != "" {
|
var unCompressionBody io.ReadCloser
|
||||||
var unCompressionBody io.ReadCloser
|
unCompressionBody, err = tools.CompressionHeadersDecode(ctx.Context(), ctx.Body(), encoding)
|
||||||
unCompressionBody, err = tools.CompressionHeadersDecode(ctx.Context(), ctx.Body(), encoding)
|
if err != nil {
|
||||||
if err != nil {
|
if err != io.ErrUnexpectedEOF && err != io.EOF {
|
||||||
if err != io.ErrUnexpectedEOF && err != io.EOF {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if unCompressionBody != nil {
|
|
||||||
ctx.response.Body = unCompressionBody
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.Contains(ctx.response.Header.Get("Content-Type"), "text/event-stream") {
|
if unCompressionBody != nil {
|
||||||
ctx.sse = newSSE(ctx)
|
ctx.response.Body = unCompressionBody
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if strings.Contains(ctx.response.Header.Get("Content-Type"), "text/event-stream") {
|
||||||
|
ctx.sse = newSSE(ctx)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user