objective-http 1.2.2 → 1.2.3

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/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"objective-http","version":"1.2.2","description":"Proxy classes for creating a http server","keywords":["web","web-server","http","http-server","oop"],"author":{"name":"volatilization","email":"volatilization@yandex.ru"},"repository":{"url":"git+https://github.com/volatilization/objective-http.git"},"license":"LGPL-3.0-only","main":"src/js/index.js"}
1
+ {"name":"objective-http","version":"1.2.3","description":"Proxy classes for creating a http server","keywords":["web","web-server","http","http-server","oop"],"author":{"name":"volatilization","email":"volatilization@yandex.ru"},"repository":{"url":"git+https://github.com/volatilization/objective-http.git"},"license":"LGPL-3.0-only","main":"src/js/index.js"}
@@ -23,7 +23,7 @@ module.exports = class OutputResponse {
23
23
  });
24
24
 
25
25
  } catch (e) {
26
- throw new Error(e.message, {cause: 'INVALID_RESPONSE'})
26
+ throw new Error(e.message, {cause: 'INVALID_RESPONSE'});
27
27
  }
28
28
  }
29
29
 
@@ -12,8 +12,8 @@ module.exports = class InputResponse {
12
12
  }
13
13
 
14
14
  flush() {
15
- try {
16
- return new Promise((resolve, reject) => {
15
+ return new Promise((resolve, reject) => {
16
+ try {
17
17
  this.#inputStream.once('error', (e) => reject(new Error(e.message, {cause: 'INVALID_RESPONSE'})));
18
18
 
19
19
  let chunks = [];
@@ -25,11 +25,11 @@ module.exports = class InputResponse {
25
25
  body: Buffer.concat(chunks)
26
26
  }
27
27
  )));
28
- });
29
28
 
30
- } catch (e) {
31
- throw new Error(e.message, {cause: 'INVALID_RESPONSE'});
32
- }
29
+ } catch (e) {
30
+ throw new Error(e.message, {cause: 'INVALID_RESPONSE'});
31
+ }
32
+ });
33
33
  }
34
34
 
35
35
  statusCode() {
@@ -13,22 +13,27 @@ module.exports = class InputRequest {
13
13
 
14
14
  flush() {
15
15
  return new Promise((resolve, reject) => {
16
- this.#inputStream.once('error', (e) =>
17
- reject(new Error(e.message, {cause: 'INVALID_REQUEST'}))
18
- );
19
-
20
- let chunks = [];
21
- this.#inputStream.on('data', (chunk) => chunks.push(chunk));
22
- this.#inputStream.on('end', () => resolve(new InputRequest(
23
- this.#inputStream,
24
- {
25
- method: this.#inputStream.method,
26
- path: new URL(this.#inputStream.url, 'http://dummy').pathname,
27
- query: new URL(this.#inputStream.url, 'http://dummy').searchParams,
28
- headers: new Headers(this.#inputStream.headers),
29
- body: Buffer.concat(chunks)
30
- }
31
- )));
16
+ try {
17
+ this.#inputStream.once('error', (e) =>
18
+ reject(new Error(e.message, {cause: 'INVALID_REQUEST'}))
19
+ );
20
+
21
+ let chunks = [];
22
+ this.#inputStream.on('data', (chunk) => chunks.push(chunk));
23
+ this.#inputStream.on('end', () => resolve(new InputRequest(
24
+ this.#inputStream,
25
+ {
26
+ method: this.#inputStream.method,
27
+ path: new URL(this.#inputStream.url, 'http://dummy').pathname,
28
+ query: new URL(this.#inputStream.url, 'http://dummy').searchParams,
29
+ headers: new Headers(this.#inputStream.headers),
30
+ body: Buffer.concat(chunks)
31
+ }
32
+ )));
33
+
34
+ } catch (e) {
35
+ throw new Error(e.message, {cause: 'INVALID_REQUEST'});
36
+ }
32
37
  });
33
38
  }
34
39