api-def 0.14.1 → 0.14.2

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.
@@ -140,18 +140,7 @@ class FetchRequestBackend {
140
140
  if (requestConfig.debug) {
141
141
  console.log(`[api-def] Fetching '${url.href}' with options`, JSON.stringify(fetchOptions, null, 2));
142
142
  }
143
- let request;
144
- try {
145
- request = new Request(url.href, fetchOptions);
146
- }
147
- catch (error) {
148
- if (context.validation.bodyEncoding === "multipart/form-data") {
149
- throw Object.assign(new Error("[api-def] multipart/form-data requires a fetch-compatible FormData implementation"), {
150
- cause: error,
151
- });
152
- }
153
- throw error;
154
- }
143
+ const request = new Request(url.href, fetchOptions);
155
144
  if (context.validation.bodyEncoding === "multipart/form-data" && Utils.isFormDataLike(body)) {
156
145
  const contentType = request.headers.get("content-type");
157
146
  if (!contentType?.toLowerCase().startsWith("multipart/form-data")) {
@@ -105,18 +105,7 @@ export default class FetchRequestBackend {
105
105
  if (requestConfig.debug) {
106
106
  console.log(`[api-def] Fetching '${url.href}' with options`, JSON.stringify(fetchOptions, null, 2));
107
107
  }
108
- let request;
109
- try {
110
- request = new Request(url.href, fetchOptions);
111
- }
112
- catch (error) {
113
- if (context.validation.bodyEncoding === "multipart/form-data") {
114
- throw Object.assign(new Error("[api-def] multipart/form-data requires a fetch-compatible FormData implementation"), {
115
- cause: error,
116
- });
117
- }
118
- throw error;
119
- }
108
+ const request = new Request(url.href, fetchOptions);
120
109
  if (context.validation.bodyEncoding === "multipart/form-data" && Utils.isFormDataLike(body)) {
121
110
  const contentType = request.headers.get("content-type");
122
111
  if (!contentType?.toLowerCase().startsWith("multipart/form-data")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-def",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "Typed API definitions with middleware support",
5
5
  "main": "cjs/index.js",
6
6
  "types": "esm/index.d.ts",