Skip to content

Commit

Permalink
Do not try charset conversion if Accept-Encoding specified
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Aug 28, 2023
1 parent 23dae15 commit 93b933a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ import (
"crypto/tls"
"errors"
"fmt"
"io"
"log"
"mime"
"net"
"net/http"
"net/http/httptrace"
"net/textproto"
"net/url"
"runtime"
"strconv"
"strings"
"sync"
"time"

"github.com/imroc/req/v3/http2"
"github.com/imroc/req/v3/internal/altsvcutil"
"github.com/imroc/req/v3/internal/ascii"
Expand All @@ -33,19 +47,6 @@ import (
reqtls "github.com/imroc/req/v3/pkg/tls"
htmlcharset "golang.org/x/net/html/charset"
"golang.org/x/text/encoding/ianaindex"
"io"
"log"
"mime"
"net"
"net/http"
"net/http/httptrace"
"net/textproto"
"net/url"
"runtime"
"strconv"
"strings"
"sync"
"time"

"golang.org/x/net/http/httpguts"
)
Expand Down Expand Up @@ -688,7 +689,7 @@ func (t *Transport) wrapResponseBody(res *http.Response, wrap wrapResponseBodyFu
}

func (t *Transport) autoDecodeResponseBody(res *http.Response) {
if t.disableAutoDecode {
if t.disableAutoDecode || res.Header.Get("Accept-Encoding") != "" {
return
}
contentType := res.Header.Get("Content-Type")
Expand Down

0 comments on commit 93b933a

Please sign in to comment.