@readyfor/api-client-base 0.243.0 → 0.244.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fetcher.mjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/utils/headersInit.d.mts +17 -0
- package/dist/utils/headersInit.d.ts +17 -0
- package/dist/utils/headersInit.js +44 -0
- package/dist/utils/headersInit.mjs +19 -0
- package/package.json +6 -3
- package/dist/requestUrl.test.d.mts +0 -2
- package/dist/requestUrl.test.d.ts +0 -2
- package/dist/requestUrl.test.js +0 -171
- package/dist/requestUrl.test.mjs +0 -114
package/dist/fetcher.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
createVoidFetcher
|
|
6
6
|
} from "./chunk-BNXKKSJH.mjs";
|
|
7
7
|
import "./chunk-PY35XWDS.mjs";
|
|
8
|
-
import "./chunk-JCZWXJBU.mjs";
|
|
9
8
|
import "./chunk-472P3XVV.mjs";
|
|
10
9
|
import "./chunk-3SEO7S3Q.mjs";
|
|
10
|
+
import "./chunk-JCZWXJBU.mjs";
|
|
11
11
|
export {
|
|
12
12
|
createBlobFetcher,
|
|
13
13
|
createJsonFetcher,
|
package/dist/index.mjs
CHANGED
|
@@ -10,10 +10,6 @@ import {
|
|
|
10
10
|
errorTitle,
|
|
11
11
|
getErrorStatus
|
|
12
12
|
} from "./chunk-PY35XWDS.mjs";
|
|
13
|
-
import {
|
|
14
|
-
isZodError,
|
|
15
|
-
schemaForType
|
|
16
|
-
} from "./chunk-JCZWXJBU.mjs";
|
|
17
13
|
import {
|
|
18
14
|
__internal__requestUrl
|
|
19
15
|
} from "./chunk-RGDL3AEX.mjs";
|
|
@@ -25,6 +21,10 @@ import {
|
|
|
25
21
|
createStore
|
|
26
22
|
} from "./chunk-3SEO7S3Q.mjs";
|
|
27
23
|
import "./chunk-WBQAMGXK.mjs";
|
|
24
|
+
import {
|
|
25
|
+
isZodError,
|
|
26
|
+
schemaForType
|
|
27
|
+
} from "./chunk-JCZWXJBU.mjs";
|
|
28
28
|
export {
|
|
29
29
|
HTTPError,
|
|
30
30
|
__internal__requestUrl,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 二つのHeadersInitの情報を元に、新たなHeadersInitを作成する
|
|
3
|
+
*
|
|
4
|
+
* Set-Cookieヘッダーは両方のHeadersInitから取得し、マージ後のHeadersに追加される。
|
|
5
|
+
* それ以外のヘッダーは、後勝ちの形式で新たなHeadersInitにマージされる。
|
|
6
|
+
*
|
|
7
|
+
* ヘッダーを削除する仕組みなどは非対応。
|
|
8
|
+
*
|
|
9
|
+
* Set-Cookieを特別扱いするのは、Fetch APIの仕様に基づいている。
|
|
10
|
+
* https://fetch.spec.whatwg.org/#terminology-headers
|
|
11
|
+
*
|
|
12
|
+
* @param baseHeadersInit 元となるHeadersInit
|
|
13
|
+
* @param overrideHeadersInit 上書きしたいヘッダーを含むHeadersInit。
|
|
14
|
+
*/
|
|
15
|
+
declare const mergeHeadersInit: (baseHeadersInit: HeadersInit, overrideHeadersInit: HeadersInit) => HeadersInit;
|
|
16
|
+
|
|
17
|
+
export { mergeHeadersInit };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 二つのHeadersInitの情報を元に、新たなHeadersInitを作成する
|
|
3
|
+
*
|
|
4
|
+
* Set-Cookieヘッダーは両方のHeadersInitから取得し、マージ後のHeadersに追加される。
|
|
5
|
+
* それ以外のヘッダーは、後勝ちの形式で新たなHeadersInitにマージされる。
|
|
6
|
+
*
|
|
7
|
+
* ヘッダーを削除する仕組みなどは非対応。
|
|
8
|
+
*
|
|
9
|
+
* Set-Cookieを特別扱いするのは、Fetch APIの仕様に基づいている。
|
|
10
|
+
* https://fetch.spec.whatwg.org/#terminology-headers
|
|
11
|
+
*
|
|
12
|
+
* @param baseHeadersInit 元となるHeadersInit
|
|
13
|
+
* @param overrideHeadersInit 上書きしたいヘッダーを含むHeadersInit。
|
|
14
|
+
*/
|
|
15
|
+
declare const mergeHeadersInit: (baseHeadersInit: HeadersInit, overrideHeadersInit: HeadersInit) => HeadersInit;
|
|
16
|
+
|
|
17
|
+
export { mergeHeadersInit };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/headersInit.ts
|
|
21
|
+
var headersInit_exports = {};
|
|
22
|
+
__export(headersInit_exports, {
|
|
23
|
+
mergeHeadersInit: () => mergeHeadersInit
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(headersInit_exports);
|
|
26
|
+
var mergeHeadersInit = (baseHeadersInit, overrideHeadersInit) => {
|
|
27
|
+
const base = new Headers(baseHeadersInit);
|
|
28
|
+
const override = new Headers(overrideHeadersInit);
|
|
29
|
+
const setCookies = base.getSetCookie().concat(override.getSetCookie());
|
|
30
|
+
base.delete("set-cookie");
|
|
31
|
+
override.delete("set-cookie");
|
|
32
|
+
const mergedHeaders = new Headers({
|
|
33
|
+
...Object.fromEntries(base),
|
|
34
|
+
...Object.fromEntries(override)
|
|
35
|
+
});
|
|
36
|
+
setCookies.forEach((cookie) => {
|
|
37
|
+
mergedHeaders.append("set-cookie", cookie);
|
|
38
|
+
});
|
|
39
|
+
return mergedHeaders;
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
mergeHeadersInit
|
|
44
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/utils/headersInit.ts
|
|
2
|
+
var mergeHeadersInit = (baseHeadersInit, overrideHeadersInit) => {
|
|
3
|
+
const base = new Headers(baseHeadersInit);
|
|
4
|
+
const override = new Headers(overrideHeadersInit);
|
|
5
|
+
const setCookies = base.getSetCookie().concat(override.getSetCookie());
|
|
6
|
+
base.delete("set-cookie");
|
|
7
|
+
override.delete("set-cookie");
|
|
8
|
+
const mergedHeaders = new Headers({
|
|
9
|
+
...Object.fromEntries(base),
|
|
10
|
+
...Object.fromEntries(override)
|
|
11
|
+
});
|
|
12
|
+
setCookies.forEach((cookie) => {
|
|
13
|
+
mergedHeaders.append("set-cookie", cookie);
|
|
14
|
+
});
|
|
15
|
+
return mergedHeaders;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
mergeHeadersInit
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readyfor/api-client-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.244.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -67,8 +67,11 @@
|
|
|
67
67
|
"esm"
|
|
68
68
|
],
|
|
69
69
|
"entry": [
|
|
70
|
-
"src"
|
|
70
|
+
"src/**/*.ts",
|
|
71
|
+
"src/**/*.tsx",
|
|
72
|
+
"!src/**/*.test.ts",
|
|
73
|
+
"!src/**/*.test.tsx"
|
|
71
74
|
]
|
|
72
75
|
},
|
|
73
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "34d4ae8b14fae52bbd3d728f1d2a3bea51444a61"
|
|
74
77
|
}
|
package/dist/requestUrl.test.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
|
|
25
|
-
// src/requestUrl.ts
|
|
26
|
-
var import_qs = __toESM(require("qs"));
|
|
27
|
-
|
|
28
|
-
// src/store.ts
|
|
29
|
-
var createStore = (initialState) => {
|
|
30
|
-
let state = initialState;
|
|
31
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
32
|
-
const getState = () => state;
|
|
33
|
-
const setState = (fn) => {
|
|
34
|
-
state = fn(state);
|
|
35
|
-
listeners.forEach((listener) => listener());
|
|
36
|
-
};
|
|
37
|
-
const subscribe = (listener) => {
|
|
38
|
-
listeners.add(listener);
|
|
39
|
-
return () => listeners.delete(listener);
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
getState,
|
|
43
|
-
setState,
|
|
44
|
-
subscribe
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// src/apiClientConfigStore.ts
|
|
49
|
-
var defaultConfig = {};
|
|
50
|
-
var store = createStore(defaultConfig);
|
|
51
|
-
|
|
52
|
-
// src/requestUrl.ts
|
|
53
|
-
function __internal__requestUrl(...args) {
|
|
54
|
-
const config2 = store.getState();
|
|
55
|
-
const rawPath = args[0];
|
|
56
|
-
const params = args[1] || {};
|
|
57
|
-
const query = args[2];
|
|
58
|
-
const hostName = config2.hostName ? typeof config2.hostName === "string" ? config2.hostName : config2.hostName(rawPath) : "";
|
|
59
|
-
const path = hostName + Object.entries(params).reduce(
|
|
60
|
-
(path2, [key, value]) => path2.replace(`{${key}}`, String(value)),
|
|
61
|
-
rawPath
|
|
62
|
-
);
|
|
63
|
-
return query ? `${path}?${import_qs.default.stringify(query)}` : path;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/requestUrl.test.ts
|
|
67
|
-
var config = {
|
|
68
|
-
hostName: (url) => url.startsWith("/api/v1") ? "https://v1host.example.com" : "https://v2host.example.com"
|
|
69
|
-
};
|
|
70
|
-
describe("__internal_requestUrl", () => {
|
|
71
|
-
describe("path\u306E\u307F\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u306E\u6642", () => {
|
|
72
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6642", () => {
|
|
73
|
-
test("path\u304C\u305D\u306E\u307E\u307E\u8FD4\u3055\u308C\u308B", () => {
|
|
74
|
-
store.setState(() => ({}));
|
|
75
|
-
expect(__internal__requestUrl("/api/v1/my/fundraising/header")).toEqual(
|
|
76
|
-
"/api/v1/my/fundraising/header"
|
|
77
|
-
);
|
|
78
|
-
expect(__internal__requestUrl("/api/v2/token")).toEqual(
|
|
79
|
-
"/api/v2/token"
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u6642", () => {
|
|
84
|
-
test("hostUrl\u4ED8\u304D\u306EURL\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
85
|
-
store.setState(() => config);
|
|
86
|
-
expect(__internal__requestUrl("/api/v1/my/fundraising/header")).toEqual(
|
|
87
|
-
"https://v1host.example.com/api/v1/my/fundraising/header"
|
|
88
|
-
);
|
|
89
|
-
expect(__internal__requestUrl("/api/v2/token")).toEqual(
|
|
90
|
-
"https://v2host.example.com/api/v2/token"
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
describe("path\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3042\u308B\u6642", () => {
|
|
96
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6642", () => {
|
|
97
|
-
test("path\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u305Fpath\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
98
|
-
store.setState(() => ({}));
|
|
99
|
-
expect(
|
|
100
|
-
__internal__requestUrl(
|
|
101
|
-
"/api/v1/my/fundraising/projects/{project_id}",
|
|
102
|
-
{
|
|
103
|
-
project_id: 12345
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
).toEqual("/api/v1/my/fundraising/projects/12345");
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u6642", () => {
|
|
110
|
-
test("path\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u305FURL\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
111
|
-
store.setState(() => config);
|
|
112
|
-
expect(
|
|
113
|
-
__internal__requestUrl(
|
|
114
|
-
"/api/v1/my/fundraising/projects/{project_id}",
|
|
115
|
-
{
|
|
116
|
-
project_id: 12345
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
).toEqual(
|
|
120
|
-
"https://v1host.example.com/api/v1/my/fundraising/projects/12345"
|
|
121
|
-
);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
describe("query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3042\u308B\u6642", () => {
|
|
126
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6642", () => {
|
|
127
|
-
test("query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3064\u3051\u3089\u308C\u305Fpath\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
128
|
-
store.setState(() => ({}));
|
|
129
|
-
expect(
|
|
130
|
-
__internal__requestUrl(
|
|
131
|
-
"/api/v1/my/messages/tree",
|
|
132
|
-
{},
|
|
133
|
-
{ follow_id: 12345 }
|
|
134
|
-
)
|
|
135
|
-
).toEqual("/api/v1/my/messages/tree?follow_id=12345");
|
|
136
|
-
expect(
|
|
137
|
-
__internal__requestUrl(
|
|
138
|
-
"/api/v2/contributions/project_info",
|
|
139
|
-
{},
|
|
140
|
-
{ project_id: "12345" }
|
|
141
|
-
)
|
|
142
|
-
).toEqual("/api/v2/contributions/project_info?project_id=12345");
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u6642", () => {
|
|
146
|
-
test("query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3064\u3051\u3089\u308C\u305FURL\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
147
|
-
store.setState(() => config);
|
|
148
|
-
expect(
|
|
149
|
-
__internal__requestUrl(
|
|
150
|
-
"/api/v1/my/messages/tree",
|
|
151
|
-
{},
|
|
152
|
-
{ follow_id: 12345 }
|
|
153
|
-
)
|
|
154
|
-
).toEqual(
|
|
155
|
-
"https://v1host.example.com/api/v1/my/messages/tree?follow_id=12345"
|
|
156
|
-
);
|
|
157
|
-
expect(
|
|
158
|
-
__internal__requestUrl(
|
|
159
|
-
"/api/v2/contributions/project_info",
|
|
160
|
-
{},
|
|
161
|
-
{ project_id: "12345" }
|
|
162
|
-
)
|
|
163
|
-
).toEqual(
|
|
164
|
-
"https://v2host.example.com/api/v2/contributions/project_info?project_id=12345"
|
|
165
|
-
);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
describe("path\u30D1\u30E9\u30E1\u30FC\u30BF\u3068query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3042\u308B\u6642", () => {
|
|
170
|
-
});
|
|
171
|
-
});
|
package/dist/requestUrl.test.mjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__internal__requestUrl
|
|
3
|
-
} from "./chunk-RGDL3AEX.mjs";
|
|
4
|
-
import {
|
|
5
|
-
store
|
|
6
|
-
} from "./chunk-472P3XVV.mjs";
|
|
7
|
-
import "./chunk-3SEO7S3Q.mjs";
|
|
8
|
-
|
|
9
|
-
// src/requestUrl.test.ts
|
|
10
|
-
var config = {
|
|
11
|
-
hostName: (url) => url.startsWith("/api/v1") ? "https://v1host.example.com" : "https://v2host.example.com"
|
|
12
|
-
};
|
|
13
|
-
describe("__internal_requestUrl", () => {
|
|
14
|
-
describe("path\u306E\u307F\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u306E\u6642", () => {
|
|
15
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6642", () => {
|
|
16
|
-
test("path\u304C\u305D\u306E\u307E\u307E\u8FD4\u3055\u308C\u308B", () => {
|
|
17
|
-
store.setState(() => ({}));
|
|
18
|
-
expect(__internal__requestUrl("/api/v1/my/fundraising/header")).toEqual(
|
|
19
|
-
"/api/v1/my/fundraising/header"
|
|
20
|
-
);
|
|
21
|
-
expect(__internal__requestUrl("/api/v2/token")).toEqual(
|
|
22
|
-
"/api/v2/token"
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u6642", () => {
|
|
27
|
-
test("hostUrl\u4ED8\u304D\u306EURL\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
28
|
-
store.setState(() => config);
|
|
29
|
-
expect(__internal__requestUrl("/api/v1/my/fundraising/header")).toEqual(
|
|
30
|
-
"https://v1host.example.com/api/v1/my/fundraising/header"
|
|
31
|
-
);
|
|
32
|
-
expect(__internal__requestUrl("/api/v2/token")).toEqual(
|
|
33
|
-
"https://v2host.example.com/api/v2/token"
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe("path\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3042\u308B\u6642", () => {
|
|
39
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6642", () => {
|
|
40
|
-
test("path\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u305Fpath\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
41
|
-
store.setState(() => ({}));
|
|
42
|
-
expect(
|
|
43
|
-
__internal__requestUrl(
|
|
44
|
-
"/api/v1/my/fundraising/projects/{project_id}",
|
|
45
|
-
{
|
|
46
|
-
project_id: 12345
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
).toEqual("/api/v1/my/fundraising/projects/12345");
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u6642", () => {
|
|
53
|
-
test("path\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u305FURL\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
54
|
-
store.setState(() => config);
|
|
55
|
-
expect(
|
|
56
|
-
__internal__requestUrl(
|
|
57
|
-
"/api/v1/my/fundraising/projects/{project_id}",
|
|
58
|
-
{
|
|
59
|
-
project_id: 12345
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
).toEqual(
|
|
63
|
-
"https://v1host.example.com/api/v1/my/fundraising/projects/12345"
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
describe("query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3042\u308B\u6642", () => {
|
|
69
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6642", () => {
|
|
70
|
-
test("query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3064\u3051\u3089\u308C\u305Fpath\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
71
|
-
store.setState(() => ({}));
|
|
72
|
-
expect(
|
|
73
|
-
__internal__requestUrl(
|
|
74
|
-
"/api/v1/my/messages/tree",
|
|
75
|
-
{},
|
|
76
|
-
{ follow_id: 12345 }
|
|
77
|
-
)
|
|
78
|
-
).toEqual("/api/v1/my/messages/tree?follow_id=12345");
|
|
79
|
-
expect(
|
|
80
|
-
__internal__requestUrl(
|
|
81
|
-
"/api/v2/contributions/project_info",
|
|
82
|
-
{},
|
|
83
|
-
{ project_id: "12345" }
|
|
84
|
-
)
|
|
85
|
-
).toEqual("/api/v2/contributions/project_info?project_id=12345");
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
describe("url\u306Econfig\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u6642", () => {
|
|
89
|
-
test("query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3064\u3051\u3089\u308C\u305FURL\u304C\u8FD4\u3055\u308C\u308B", () => {
|
|
90
|
-
store.setState(() => config);
|
|
91
|
-
expect(
|
|
92
|
-
__internal__requestUrl(
|
|
93
|
-
"/api/v1/my/messages/tree",
|
|
94
|
-
{},
|
|
95
|
-
{ follow_id: 12345 }
|
|
96
|
-
)
|
|
97
|
-
).toEqual(
|
|
98
|
-
"https://v1host.example.com/api/v1/my/messages/tree?follow_id=12345"
|
|
99
|
-
);
|
|
100
|
-
expect(
|
|
101
|
-
__internal__requestUrl(
|
|
102
|
-
"/api/v2/contributions/project_info",
|
|
103
|
-
{},
|
|
104
|
-
{ project_id: "12345" }
|
|
105
|
-
)
|
|
106
|
-
).toEqual(
|
|
107
|
-
"https://v2host.example.com/api/v2/contributions/project_info?project_id=12345"
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
describe("path\u30D1\u30E9\u30E1\u30FC\u30BF\u3068query\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u3042\u308B\u6642", () => {
|
|
113
|
-
});
|
|
114
|
-
});
|