connectbase-client 0.1.13 → 0.1.14

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.
Files changed (2) hide show
  1. package/dist/cli.js +11 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -165,19 +165,23 @@ function collectFiles(dir, baseDir = dir) {
165
165
  }
166
166
  return files;
167
167
  }
168
- function makeRequest(url, method, headers, body) {
168
+ async function makeRequest(url, method, headers, body) {
169
169
  return new Promise((resolve2, reject) => {
170
170
  const parsedUrl = new URL(url);
171
171
  const isHttps = parsedUrl.protocol === "https:";
172
172
  const lib = isHttps ? https : http;
173
+ const bodyBuffer = body ? Buffer.from(body, "utf-8") : null;
173
174
  const options = {
174
175
  hostname: parsedUrl.hostname,
175
176
  port: parsedUrl.port || (isHttps ? 443 : 80),
176
177
  path: parsedUrl.pathname + parsedUrl.search,
177
178
  method,
179
+ family: 4,
180
+ autoSelectFamily: false,
178
181
  headers: {
179
182
  ...headers,
180
- "Content-Type": "application/json"
183
+ "Content-Type": "application/json",
184
+ ...bodyBuffer ? { "Content-Length": bodyBuffer.length } : {}
181
185
  }
182
186
  };
183
187
  const req = lib.request(options, (res) => {
@@ -194,9 +198,12 @@ function makeRequest(url, method, headers, body) {
194
198
  }
195
199
  });
196
200
  });
201
+ req.setTimeout(6e4, () => {
202
+ req.destroy(new Error("\uC694\uCCAD \uC2DC\uAC04 \uCD08\uACFC (60\uCD08)"));
203
+ });
197
204
  req.on("error", reject);
198
- if (body) {
199
- req.write(body);
205
+ if (bodyBuffer) {
206
+ req.write(bodyBuffer);
200
207
  }
201
208
  req.end();
202
209
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",