diff --git a/src/fetch/index.t-test.ts b/src/fetch/index.t-test.ts index 49e4e66..a2319a2 100644 --- a/src/fetch/index.t-test.ts +++ b/src/fetch/index.t-test.ts @@ -128,4 +128,13 @@ import JSONT from "../json"; headers: { Cookie: "a=b" }, }); })(); + + (async () => { + // basePathの最後にも/があるのでhttps://example.com/api//usersとなってしまうが、ノーマライズされるので問題ない + const basePath = "https://example.com/api/"; + const f = fetch as FetchT; + await f(`${basePath}/users`, { + headers: { Cookie: "a=b" }, + }); + })(); } diff --git a/src/fetch/index.ts b/src/fetch/index.ts index 320f169..0d63816 100644 --- a/src/fetch/index.ts +++ b/src/fetch/index.ts @@ -36,9 +36,9 @@ type FetchT = < Input extends | `${ToUrlParamPattern}${ToUrlParamPattern}` | `${ToUrlParamPattern}${ToUrlParamPattern}?${string}`, - InputPath extends ParseURL< - Replace, NormalizePath, ""> - >["path"], + InputPath extends NormalizePath< + ParseURL>["path"] + >, CandidatePaths extends MatchedPatterns, InputMethod extends CaseInsensitiveMethod = "get", M extends Method = Lowercase,