Skip to content

Commit fbe706a

Browse files
committed
fix: fix buildFullPath judgement
1 parent a745099 commit fbe706a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/core/src/utils/buildFullPath.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ describe("utils::buildFullPath", () => {
2828
).toBe("https://github.com/api/https://api.example.com/users");
2929
});
3030

31+
it("should not combine the URLs when the requestedURL is absolute, allowAbsoluteUrls is false, and the baseURL is not configured", () => {
32+
expect(buildFullPath("", "https://api.example.com/users", false)).toBe(
33+
"https://api.example.com/users",
34+
);
35+
});
36+
3137
it("should not combine URLs when the baseURL is not configured", () => {
3238
expect(buildFullPath("", "/users", true)).toBe("/users");
3339
});

packages/core/src/utils/buildFullPath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const buildFullPath = (
77
allowAbsoluteUrls: boolean,
88
) => {
99
const isRelativeUrl = !isAbsoluteUrl(requestedUrl);
10-
if ((baseUrl && isRelativeUrl) || !allowAbsoluteUrls) {
10+
if (baseUrl && (isRelativeUrl || !allowAbsoluteUrls)) {
1111
return combineUrls(baseUrl, requestedUrl);
1212
}
1313
return requestedUrl;

0 commit comments

Comments
 (0)