@penkov/swagger-code-gen 1.7.5 → 1.7.6

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.
@@ -49,7 +49,7 @@ function valueToString(value: any): string {
49
49
  /**
50
50
  * Helper to serialize data for 'multipart/form-data'
51
51
  */
52
- function objectToForm(o: object): FormData {
52
+ function objectToForm(o: Record<string, any>): FormData {
53
53
  const res = new FormData();
54
54
  Object.keys(o)
55
55
  .filter(k => o[k] !== undefined && o[k] !== null)
@@ -68,7 +68,7 @@ function objectToForm(o: object): FormData {
68
68
  /**
69
69
  * Helper to serialize data for 'application/x-www-form-urlencoded'
70
70
  */
71
- function objectToFormWwwEncoded(o: object): string {
71
+ function objectToFormWwwEncoded(o: Record<string, any>): string {
72
72
  return Object.keys(o)
73
73
  .filter(k => o[k] !== undefined && o[k] !== null)
74
74
  .map(k => `${k}=${encodeURIComponent(valueToString(o[k]))}`)
@@ -82,7 +82,8 @@ async function requestImpl<T>(request: Request, requestOptions: RequestOptions):
82
82
  if (postProcessed.ok) {
83
83
  let json: any = null;
84
84
  if (postProcessed.headers.has('content-length')) {
85
- const ct = parseInt(postProcessed.headers.get('content-length'));
85
+ const ctLent = postProcessed.headers.get('content-length');
86
+ const ct = ctLent != null ? parseInt(ctLent): 0;
86
87
  if (ct > 0) {
87
88
  json = await postProcessed.json()
88
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@penkov/swagger-code-gen",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "generate-client": "./dist/cli.mjs"