Skip to content

Commit 8eed21a

Browse files
package details for npm publishing and required body checks
1 parent 2ef0036 commit 8eed21a

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"name": "openapi",
3+
"version": "0.0.1",
4+
"author": "speakeasy-client-sdk-generator",
25
"scripts": {
36
"lint:fix": "tsc --noemit && eslint \"./src\" --ext .ts,.tsx --fix"
47
},

src/sdk/sdk.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,13 @@ export class SDK {
11931193
const client: AxiosInstance = this.securityClient!;
11941194
const headers = { ...reqHeaders, ...config?.headers };
11951195

1196-
let body: unknown;
1196+
let body: any;
11971197
if (reqBody instanceof FormData) body = reqBody;
11981198
else body = { ...reqBody };
11991199

1200+
if (body == null || Object.keys(body).length === 0)
1201+
throw new Error("request body is required");
1202+
12001203
return client
12011204
.post(url, body, {
12021205
headers: headers,
@@ -1303,10 +1306,13 @@ export class SDK {
13031306
const client: AxiosInstance = this.securityClient!;
13041307
const headers = { ...reqHeaders, ...config?.headers };
13051308

1306-
let body: unknown;
1309+
let body: any;
13071310
if (reqBody instanceof FormData) body = reqBody;
13081311
else body = { ...reqBody };
13091312

1313+
if (body == null || Object.keys(body).length === 0)
1314+
throw new Error("request body is required");
1315+
13101316
return client
13111317
.post(url, body, {
13121318
headers: headers,
@@ -1403,10 +1409,13 @@ export class SDK {
14031409
const client: AxiosInstance = this.securityClient!;
14041410
const headers = { ...reqHeaders, ...config?.headers };
14051411

1406-
let body: unknown;
1412+
let body: any;
14071413
if (reqBody instanceof FormData) body = reqBody;
14081414
else body = { ...reqBody };
14091415

1416+
if (body == null || Object.keys(body).length === 0)
1417+
throw new Error("request body is required");
1418+
14101419
return client
14111420
.put(url, body, {
14121421
headers: headers,
@@ -1463,10 +1472,13 @@ export class SDK {
14631472
const client: AxiosInstance = this.securityClient!;
14641473
const headers = { ...reqHeaders, ...config?.headers };
14651474

1466-
let body: unknown;
1475+
let body: any;
14671476
if (reqBody instanceof FormData) body = reqBody;
14681477
else body = { ...reqBody };
14691478

1479+
if (body == null || Object.keys(body).length === 0)
1480+
throw new Error("request body is required");
1481+
14701482
return client
14711483
.put(url, body, {
14721484
headers: headers,

0 commit comments

Comments
 (0)