express-zod-api 10.0.0-beta5 → 10.0.0-beta6
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/CHANGELOG.md +10 -0
- package/README.md +4 -5
- package/dist/esm/index.js +4 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Version 10
|
|
4
4
|
|
|
5
|
+
### v10.0.0-beta6
|
|
6
|
+
|
|
7
|
+
- This release contains the fix from version 9.4.1.
|
|
8
|
+
|
|
5
9
|
### v10.0.0-beta5
|
|
6
10
|
|
|
7
11
|
- Fixed DTS path for ESM in package.json.
|
|
@@ -87,6 +91,12 @@ const uploadSchema = ez.upload(); // namespace changed
|
|
|
87
91
|
|
|
88
92
|
## Version 9
|
|
89
93
|
|
|
94
|
+
### v9.4.1
|
|
95
|
+
|
|
96
|
+
- Fixing the example implementation for the generated client in case of `DELETE` method.
|
|
97
|
+
- Since v9.0.0-beta1 request `body` is no longer accepted (by default) as an input source.
|
|
98
|
+
- The example implementation is now aligned accordingly to use query parameters.
|
|
99
|
+
|
|
90
100
|
### v9.4.0
|
|
91
101
|
|
|
92
102
|
- Feature #875, proposed by [@VideoSystemsTech](https://github.com/VideoSystemsTech).
|
package/README.md
CHANGED
|
@@ -823,13 +823,12 @@ fs.writeFileSync(
|
|
|
823
823
|
import { ExpressZodAPIClient } from "./client.ts";
|
|
824
824
|
|
|
825
825
|
const client = new ExpressZodAPIClient(async (method, path, params) => {
|
|
826
|
-
const
|
|
827
|
-
|
|
826
|
+
const hasBody = !["get", "delete"].includes(method);
|
|
827
|
+
const searchParams = hasBody ? "" : `?${new URLSearchParams(params)}`;
|
|
828
828
|
const response = await fetch(`https://example.com${path}${searchParams}`, {
|
|
829
829
|
method: method.toUpperCase(),
|
|
830
|
-
headers:
|
|
831
|
-
|
|
832
|
-
body: method === "get" ? undefined : JSON.stringify(params),
|
|
830
|
+
headers: hasBody ? { "Content-Type": "application/json" } : undefined,
|
|
831
|
+
body: hasBody ? JSON.stringify(params) : undefined,
|
|
833
832
|
});
|
|
834
833
|
return response.json();
|
|
835
834
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -36,13 +36,12 @@ export const exampleImplementation: Implementation = async (
|
|
|
36
36
|
path,
|
|
37
37
|
params
|
|
38
38
|
) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const hasBody = !["get", "delete"].includes(method);
|
|
40
|
+
const searchParams = hasBody ? "" : \`?\${new URLSearchParams(params)}\`;
|
|
41
41
|
const response = await fetch(\`https://example.com\${path}\${searchParams}\`, {
|
|
42
42
|
method: method.toUpperCase(),
|
|
43
|
-
headers:
|
|
44
|
-
|
|
45
|
-
body: method === "get" ? undefined : JSON.stringify(params),
|
|
43
|
+
headers: hasBody ? { "Content-Type": "application/json" } : undefined,
|
|
44
|
+
body: hasBody ? JSON.stringify(params) : undefined,
|
|
46
45
|
});
|
|
47
46
|
if (\`\${method} \${path}\` in jsonEndpoints) {
|
|
48
47
|
return response.json();
|