Skip to content

Commit

Permalink
Merge pull request #7 from bgoscinski/main
Browse files Browse the repository at this point in the history
refactor: Get rid of header_utils.ts
  • Loading branch information
jd1378 authored May 18, 2022
2 parents 0e69089 + 2dcdc74 commit a1b40c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 142 deletions.
8 changes: 3 additions & 5 deletions fetch_wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CookieJar } from "./cookie_jar.ts";
import { setHeader } from "./header_utils.ts";

export type WrapFetchOptions = {
/** your own fetch function. defaults to global fetch. This allows wrapping your fetch function multiple times. */
Expand Down Expand Up @@ -31,11 +30,10 @@ export function wrapFetch(options: WrapFetchOptions) {
interceptedInit = {};
}

if (!interceptedInit.headers) {
interceptedInit.headers = new Headers();
if (!(interceptedInit.headers instanceof Headers)) {
interceptedInit.headers = new Headers(interceptedInit.headers || {});
}

setHeader(interceptedInit.headers, "cookie", cookieString);
interceptedInit.headers.set("cookie", cookieString);

const response = await fetch(input, interceptedInit);
response.headers.forEach((value, key) => {
Expand Down
137 changes: 0 additions & 137 deletions header_utils.ts

This file was deleted.

0 comments on commit a1b40c1

Please sign in to comment.