Skip to content

Commit

Permalink
Fix fetch credential (#86)
Browse files Browse the repository at this point in the history
* fix authorization header.

* update deps.
  • Loading branch information
dojyorin authored Dec 28, 2023
1 parent f6a30c5 commit 50af386
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions deps.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export {assertEquals} from "https://deno.land/std@0.209.0/assert/mod.ts";
export {dirname, fromFileUrl} from "https://deno.land/std@0.209.0/path/mod.ts";
export {exists} from "https://deno.land/std@0.209.0/fs/mod.ts";
export {assertEquals} from "https://deno.land/std@0.210.0/assert/mod.ts";
export {dirname, fromFileUrl} from "https://deno.land/std@0.210.0/path/mod.ts";
export {exists} from "https://deno.land/std@0.210.0/fs/mod.ts";
6 changes: 3 additions & 3 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export {dirname, fromFileUrl} from "https://deno.land/std@0.209.0/path/mod.ts";
export {Logger, handlers} from "https://deno.land/std@0.209.0/log/mod.ts";
export {format} from "https://deno.land/std@0.209.0/datetime/mod.ts";
export {dirname, fromFileUrl} from "https://deno.land/std@0.210.0/path/mod.ts";
export {Logger, handlers} from "https://deno.land/std@0.210.0/log/mod.ts";
export {format} from "https://deno.land/std@0.210.0/datetime/mod.ts";
3 changes: 1 addition & 2 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export async function fetchExtend<T extends keyof ResponseType>(path:string, typ
h.set("Authorization", `Bearer ${option.secret.key}`);
}
else if(option?.secret?.id){
u.username = option.secret.id;
u.password = option.secret.pw;
h.set("Authorization", `Basic ${btoa(`${option.secret.id}:${option.secret.pw}`)}`);
}

const response = await fetch(u.href, {
Expand Down

0 comments on commit 50af386

Please sign in to comment.