icebear commited on
Commit
866b9cd
·
unverified ·
2 Parent(s): 4ea9ca4b0a4fb7

Merge pull request #59 from icebear0828/fix/oauth-accept-encoding

Browse files
Files changed (1) hide show
  1. src/tls/curl-fetch.ts +6 -6
src/tls/curl-fetch.ts CHANGED
@@ -31,9 +31,9 @@ export async function curlFetchGet(
31
  ): Promise<CurlFetchResponse> {
32
  const transport = getTransport();
33
  const headers = buildAnonymousHeaders();
34
- if (!transport.isImpersonate()) {
35
- headers["Accept-Encoding"] = "gzip, deflate";
36
- }
37
 
38
  const result = await transport.get(url, headers, 30, options?.proxyUrl);
39
  return {
@@ -54,9 +54,9 @@ export async function curlFetchPost(
54
  ): Promise<CurlFetchResponse> {
55
  const transport = getTransport();
56
  const headers = buildAnonymousHeaders();
57
- if (!transport.isImpersonate()) {
58
- headers["Accept-Encoding"] = "gzip, deflate";
59
- }
60
  headers["Content-Type"] = contentType;
61
 
62
  const result = await transport.simplePost(url, headers, body, 30, options?.proxyUrl);
 
31
  ): Promise<CurlFetchResponse> {
32
  const transport = getTransport();
33
  const headers = buildAnonymousHeaders();
34
+ // Let --compressed auto-negotiate Accept-Encoding based on curl's actual
35
+ // decompression capabilities, avoiding error 61 on builds lacking br/zstd.
36
+ delete headers["Accept-Encoding"];
37
 
38
  const result = await transport.get(url, headers, 30, options?.proxyUrl);
39
  return {
 
54
  ): Promise<CurlFetchResponse> {
55
  const transport = getTransport();
56
  const headers = buildAnonymousHeaders();
57
+ // Let --compressed auto-negotiate Accept-Encoding based on curl's actual
58
+ // decompression capabilities, avoiding error 61 on builds lacking br/zstd.
59
+ delete headers["Accept-Encoding"];
60
  headers["Content-Type"] = contentType;
61
 
62
  const result = await transport.simplePost(url, headers, body, 30, options?.proxyUrl);