diff --git a/README.md b/README.md index c912151..13526e1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ import { Cookie, CookieJar, wrapFetch, -} from "https://deno.land/x/another_cookiejar@v5.0.3/mod.ts"; +} from "https://deno.land/x/another_cookiejar@v5.0.4/mod.ts"; ``` ### wrapFetch diff --git a/fetch_wrapper.ts b/fetch_wrapper.ts index 0506da1..30726cb 100644 --- a/fetch_wrapper.ts +++ b/fetch_wrapper.ts @@ -66,7 +66,10 @@ export function wrapFetch(options?: WrapFetchOptions): typeof fetch { }); } - reqHeaders.set("cookie", cookieString); + if (cookieString.length) { + reqHeaders.set("cookie", cookieString); + } + reqHeaders.delete("cookie2"); // Remove cookie2 if it exists, It's deprecated interceptedInit.headers = reqHeaders;