-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏭 Add partial typing for the wretch options
- Loading branch information
Showing
6 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import factory from "./index.js"; | ||
import factory from "./index.js" | ||
|
||
module.exports = factory.default; | ||
module.exports = factory.default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { | ||
assertEquals, | ||
fail | ||
} from "https://deno.land/[email protected]/testing/asserts.ts" | ||
} from "jsr:@std/assert" | ||
import { | ||
beforeAll, | ||
describe, | ||
it, | ||
} from "https://deno.land/[email protected]/testing/bdd.ts" | ||
} from "jsr:@std/testing/bdd" | ||
|
||
import wretchFn from "../../dist/bundle/wretch.min.mjs" | ||
import BasicAuthAddon from "../../dist/bundle/addons/basicAuth.min.mjs" | ||
|
@@ -15,7 +15,7 @@ import FormDataAddon from "../../dist/bundle/addons/formData.min.mjs" | |
import QueryAddon from "../../dist/bundle/addons/queryString.min.mjs" | ||
import AbortAddon from "../../dist/bundle/addons/abort.min.mjs" | ||
// import PerfsAddon from "../../dist/bundle/addons/perfs.min.mjs" | ||
import type { Wretch, WretchResponseChain, WretchResponse, Middleware } from "../../dist/types.d.ts" | ||
import type { Wretch, WretchResponseChain, WretchResponse, Middleware, WretchError } from "../../dist/types.d.ts" | ||
Check failure on line 18 in test/deno/wretch_test.ts GitHub Actions / browsers-test
Check failure on line 18 in test/deno/wretch_test.ts GitHub Actions / deno-tests
Check failure on line 18 in test/deno/wretch_test.ts GitHub Actions / nodejs-test (16)
Check failure on line 18 in test/deno/wretch_test.ts GitHub Actions / nodejs-test (18)
|
||
|
||
declare type factory = { | ||
(_url?: string, _options?: object): Wretch; | ||
|
@@ -117,7 +117,7 @@ describe("Wretch", function () { | |
} | ||
// Ensure that the charset is preserved. | ||
const headerWithCharset = "application/json; charset=utf-16" | ||
assertEquals((wretch()).content(headerWithCharset).json({})._options.headers["Content-Type"], headerWithCharset) | ||
assertEquals((wretch()).content(headerWithCharset).json({})._options.headers?.["Content-Type" as keyof HeadersInit], headerWithCharset) | ||
}) | ||
|
||
it("should perform an url encoded form data round trip", async function () { | ||
|
@@ -395,7 +395,7 @@ describe("Wretch", function () { | |
await wretch(_URL + "/basicauth") | ||
.get() | ||
.res(_ => fail("Authenticated route should not respond without credentials.")) | ||
} catch (e) { | ||
} catch (e: any) { | ||
assertEquals(e.status, 401) | ||
} | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters