api-def 0.12.0-alpha.13 → 0.12.0-alpha.15
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/cjs/ApiTypes.d.ts +1 -0
- package/cjs/RequestContext.d.ts +1 -0
- package/cjs/RequestContext.js +5 -0
- package/cjs/backend/FetchRequestBackend.js +3 -0
- package/esm/ApiTypes.d.ts +1 -0
- package/esm/RequestContext.d.ts +1 -0
- package/esm/RequestContext.js +5 -0
- package/esm/backend/FetchRequestBackend.js +3 -0
- package/package.json +1 -1
package/cjs/ApiTypes.d.ts
CHANGED
package/cjs/RequestContext.d.ts
CHANGED
|
@@ -48,5 +48,6 @@ export default class RequestContext<TResponse = any, TParams extends Params | un
|
|
|
48
48
|
updatePath(path: string): void;
|
|
49
49
|
updateBaseUrl(baseUrl: string): void;
|
|
50
50
|
updateMethod(method: RequestMethod): void;
|
|
51
|
+
updateBody(body: TBody): void;
|
|
51
52
|
private generateRequestUrl;
|
|
52
53
|
}
|
package/cjs/RequestContext.js
CHANGED
|
@@ -219,6 +219,11 @@ var RequestContext = /** @class */ (function () {
|
|
|
219
219
|
RequestContext.prototype.updateMethod = function (method) {
|
|
220
220
|
this.computedMethod = method;
|
|
221
221
|
};
|
|
222
|
+
RequestContext.prototype.updateBody = function (body) {
|
|
223
|
+
// @ts-ignore
|
|
224
|
+
this.computedConfig.body = body;
|
|
225
|
+
this.parseRequestBody();
|
|
226
|
+
};
|
|
222
227
|
RequestContext.prototype.generateRequestUrl = function () {
|
|
223
228
|
var path = !this.baseUrl.endsWith("/") ? "".concat(this.baseUrl, "/") : this.baseUrl;
|
|
224
229
|
path += this.computedPath.startsWith("/") ? this.computedPath.substring(1) : this.computedPath;
|
|
@@ -176,6 +176,9 @@ var FetchRequestBackend = /** @class */ (function () {
|
|
|
176
176
|
if ("credentials" in Request.prototype) {
|
|
177
177
|
fetchOptions.credentials = context.requestConfig.credentials ? "include" : undefined;
|
|
178
178
|
}
|
|
179
|
+
if (requestConfig.debug) {
|
|
180
|
+
console.log("[api-def] Fetching '".concat(url.href, "' with options"), JSON.stringify(fetchOptions, null, 2));
|
|
181
|
+
}
|
|
179
182
|
var promise = this.fetch(url.href, fetchOptions).then(function (response) {
|
|
180
183
|
responded = true;
|
|
181
184
|
if (!response.ok) {
|
package/esm/ApiTypes.d.ts
CHANGED
package/esm/RequestContext.d.ts
CHANGED
|
@@ -48,5 +48,6 @@ export default class RequestContext<TResponse = any, TParams extends Params | un
|
|
|
48
48
|
updatePath(path: string): void;
|
|
49
49
|
updateBaseUrl(baseUrl: string): void;
|
|
50
50
|
updateMethod(method: RequestMethod): void;
|
|
51
|
+
updateBody(body: TBody): void;
|
|
51
52
|
private generateRequestUrl;
|
|
52
53
|
}
|
package/esm/RequestContext.js
CHANGED
|
@@ -148,6 +148,11 @@ export default class RequestContext {
|
|
|
148
148
|
updateMethod(method) {
|
|
149
149
|
this.computedMethod = method;
|
|
150
150
|
}
|
|
151
|
+
updateBody(body) {
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
this.computedConfig.body = body;
|
|
154
|
+
this.parseRequestBody();
|
|
155
|
+
}
|
|
151
156
|
generateRequestUrl() {
|
|
152
157
|
let path = !this.baseUrl.endsWith("/") ? `${this.baseUrl}/` : this.baseUrl;
|
|
153
158
|
path += this.computedPath.startsWith("/") ? this.computedPath.substring(1) : this.computedPath;
|
|
@@ -111,6 +111,9 @@ export default class FetchRequestBackend {
|
|
|
111
111
|
if ("credentials" in Request.prototype) {
|
|
112
112
|
fetchOptions.credentials = context.requestConfig.credentials ? "include" : undefined;
|
|
113
113
|
}
|
|
114
|
+
if (requestConfig.debug) {
|
|
115
|
+
console.log(`[api-def] Fetching '${url.href}' with options`, JSON.stringify(fetchOptions, null, 2));
|
|
116
|
+
}
|
|
114
117
|
const promise = this.fetch(url.href, fetchOptions).then((response) => {
|
|
115
118
|
responded = true;
|
|
116
119
|
if (!response.ok) {
|