| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2455,8 +2455,8 @@ added: v0.1.17 | |||
| 2455 | 2455 | * Extends: {Stream} | |
| 2456 | 2456 | ||
| 2457 | 2457 | This class serves as the parent class of [`http.ClientRequest`][] | |
| 2458 | - and [`http.ServerResponse`][]. It is an abstract of outgoing message from | ||
| 2459 | - the perspective of the participants of HTTP transaction. | ||
| 2458 | + and [`http.ServerResponse`][]. It is an abstract outgoing message from | ||
| 2459 | + the perspective of the participants of an HTTP transaction. | ||
| 2460 | 2460 | ||
| 2461 | 2461 | ### Event: `'drain'` | |
| 2462 | 2462 | ||
@@ -2480,7 +2480,7 @@ Emitted when the transmission is finished successfully. | |||
| 2480 | 2480 | added: v0.11.6 | |
| 2481 | 2481 | --> | |
| 2482 | 2482 | ||
| 2483 | - Emitted when `outgoingMessage.end` was called. | ||
| 2483 | + Emitted after `outgoingMessage.end()` is called. | ||
| 2484 | 2484 | When the event is emitted, all data has been processed but not necessarily | |
| 2485 | 2485 | completely flushed. | |
| 2486 | 2486 | ||
@@ -2494,11 +2494,11 @@ added: v0.3.0 | |||
| 2494 | 2494 | ||
| 2495 | 2495 | Adds HTTP trailers (headers but at the end of the message) to the message. | |
| 2496 | 2496 | ||
| 2497 | - Trailers are **only** be emitted if the message is chunked encoded. If not, | ||
| 2498 | - the trailer will be silently discarded. | ||
| 2497 | + Trailers will **only** be emitted if the message is chunked encoded. If not, | ||
| 2498 | + the trailers will be silently discarded. | ||
| 2499 | 2499 | ||
| 2500 | 2500 | HTTP requires the `Trailer` header to be sent to emit trailers, | |
| 2501 | - with a list of header fields in its value, e.g. | ||
| 2501 | + with a list of header field names in its value, e.g. | ||
| 2502 | 2502 | ||
| 2503 | 2503 | ```js | |
| 2504 | 2504 | message.writeHead(200, { 'Content-Type': 'text/plain', | |
@@ -2522,7 +2522,7 @@ deprecated: | |||
| 2522 | 2522 | ||
| 2523 | 2523 | > Stability: 0 - Deprecated: Use [`outgoingMessage.socket`][] instead. | |
| 2524 | 2524 | ||
| 2525 | - Aliases of `outgoingMessage.socket` | ||
| 2525 | + Alias of [`outgoingMessage.socket`][]. | ||
| 2526 | 2526 | ||
| 2527 | 2527 | ### `outgoingMessage.cork()` | |
| 2528 | 2528 | ||
@@ -2562,22 +2562,22 @@ changes: | |||
| 2562 | 2562 | ||
| 2563 | 2563 | Finishes the outgoing message. If any parts of the body are unsent, it will | |
| 2564 | 2564 | flush them to the underlying system. If the message is chunked, it will | |
| 2565 | - send the terminating chunk `0\r\n\r\n`, and send the trailer (if any). | ||
| 2565 | + send the terminating chunk `0\r\n\r\n`, and send the trailers (if any). | ||
| 2566 | 2566 | ||
| 2567 | - If `chunk` is specified, it is equivalent to call | ||
| 2567 | + If `chunk` is specified, it is equivalent to calling | ||
| 2568 | 2568 | `outgoingMessage.write(chunk, encoding)`, followed by | |
| 2569 | 2569 | `outgoingMessage.end(callback)`. | |
| 2570 | 2570 | ||
| 2571 | - If `callback` is provided, it will be called when the message is finished. | ||
| 2572 | - (equivalent to the callback to event `finish`) | ||
| 2571 | + If `callback` is provided, it will be called when the message is finished | ||
| 2572 | + (equivalent to a listener of the `'finish'` event). | ||
| 2573 | 2573 | ||
| 2574 | 2574 | ### `outgoingMessage.flushHeaders()` | |
| 2575 | 2575 | ||
| 2576 | 2576 | <!-- YAML | |
| 2577 | 2577 | added: v1.6.0 | |
| 2578 | 2578 | --> | |
| 2579 | 2579 | ||
| 2580 | - Compulsorily flushes the message headers | ||
| 2580 | + Flushes the message headers. | ||
| 2581 | 2581 | ||
| 2582 | 2582 | For efficiency reason, Node.js normally buffers the message headers | |
| 2583 | 2583 | until `outgoingMessage.end()` is called or the first chunk of message data | |
@@ -2586,7 +2586,7 @@ packet. | |||
| 2586 | 2586 | ||
| 2587 | 2587 | It is usually desired (it saves a TCP round-trip), but not when the first | |
| 2588 | 2588 | data is not sent until possibly much later. `outgoingMessage.flushHeaders()` | |
| 2589 | - bypasses the optimization and kickstarts the request. | ||
| 2589 | + bypasses the optimization and kickstarts the message. | ||
| 2590 | 2590 | ||
| 2591 | 2591 | ### `outgoingMessage.getHeader(name)` | |
| 2592 | 2592 | ||
@@ -2597,8 +2597,8 @@ added: v0.4.0 | |||
| 2597 | 2597 | * `name` {string} Name of header | |
| 2598 | 2598 | * Returns {string | undefined} | |
| 2599 | 2599 | ||
| 2600 | - Gets the value of HTTP header with the given name. If such a name doesn't | ||
| 2601 | - exist in message, it will be `undefined`. | ||
| 2600 | + Gets the value of the HTTP header with the given name. If that header is not | ||
| 2601 | + set, the returned value will be `undefined`. | ||
| 2602 | 2602 | ||
| 2603 | 2603 | ### `outgoingMessage.getHeaderNames()` | |
| 2604 | 2604 | ||
@@ -2608,8 +2608,8 @@ added: v7.7.0 | |||
| 2608 | 2608 | ||
| 2609 | 2609 | * Returns {string\[]} | |
| 2610 | 2610 | ||
| 2611 | - Returns an array of names of headers of the outgoing outgoingMessage. All | ||
| 2612 | - names are lowercase. | ||
| 2611 | + Returns an array containing the unique names of the current outgoing headers. | ||
| 2612 | + All names are lowercase. | ||
| 2613 | 2613 | ||
| 2614 | 2614 | ### `outgoingMessage.getHeaders()` | |
| 2615 | 2615 | ||
@@ -2626,8 +2626,8 @@ object are the header names and the values are the respective header | |||
| 2626 | 2626 | values. All header names are lowercase. | |
| 2627 | 2627 | ||
| 2628 | 2628 | The object returned by the `outgoingMessage.getHeaders()` method does | |
| 2629 | - not prototypically inherit from the JavaScript Object. This means that | ||
| 2630 | - typical Object methods such as `obj.toString()`, `obj.hasOwnProperty()`, | ||
| 2629 | + not prototypically inherit from the JavaScript `Object`. This means that | ||
| 2630 | + typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, | ||
| 2631 | 2631 | and others are not defined and will not work. | |
| 2632 | 2632 | ||
| 2633 | 2633 | ```js | |
@@ -2670,14 +2670,11 @@ Read-only. `true` if the headers were sent, otherwise `false`. | |||
| 2670 | 2670 | added: v9.0.0 | |
| 2671 | 2671 | --> | |
| 2672 | 2672 | ||
| 2673 | - Overrides the pipe method of legacy `Stream` which is the parent class of | ||
| 2674 | - `http.outgoingMessage`. | ||
| 2675 | - | ||
| 2676 | - Since `OutgoingMessage` should be a write-only stream, | ||
| 2677 | - call this function will throw an `Error`. Thus, it disabled the pipe method | ||
| 2678 | - it inherits from `Stream`. | ||
| 2673 | + Overrides the `stream.pipe()` method inherited from the legacy `Stream` class | ||
| 2674 | + which is the parent class of `http.OutgoingMessage`. | ||
| 2679 | 2675 | ||
| 2680 | - The User should not call this function directly. | ||
| 2676 | + Calling this method will throw an `Error` because `outgoingMessage` is a | ||
| 2677 | + write-only stream. | ||
| 2681 | 2678 | ||
| 2682 | 2679 | ### `outgoingMessage.removeHeader(name)` | |
| 2683 | 2680 | ||
@@ -2700,10 +2697,12 @@ added: v0.4.0 | |||
| 2700 | 2697 | --> | |
| 2701 | 2698 | ||
| 2702 | 2699 | * `name` {string} Header name | |
| 2703 | - * `value` {string} Header value | ||
| 2700 | + * `value` {any} Header value | ||
| 2704 | 2701 | * Returns: {this} | |
| 2705 | 2702 | ||
| 2706 | - Sets a single header value for the header object. | ||
| 2703 | + Sets a single header value. If the header already exists in the to-be-sent | ||
| 2704 | + headers, its value will be replaced. Use an array of strings to send multiple | ||
| 2705 | + headers with the same name. | ||
| 2707 | 2706 | ||
| 2708 | 2707 | ### `outgoingMessage.setTimeout(msesc[, callback])` | |
| 2709 | 2708 | ||
@@ -2752,8 +2751,7 @@ added: | |||
| 2752 | 2751 | ||
| 2753 | 2752 | * {number} | |
| 2754 | 2753 | ||
| 2755 | - This `outgoingMessage.writableCorked` will return the time how many | ||
| 2756 | - `outgoingMessage.cork()` have been called. | ||
| 2754 | + The number of times `outgoingMessage.cork()` has been called. | ||
| 2757 | 2755 | ||
| 2758 | 2756 | ### `outgoingMessage.writableEnded` | |
| 2759 | 2757 | ||
@@ -2763,9 +2761,9 @@ added: v12.9.0 | |||
| 2763 | 2761 | ||
| 2764 | 2762 | * {boolean} | |
| 2765 | 2763 | ||
| 2766 | - Readonly, `true` if `outgoingMessage.end()` has been called. Noted that | ||
| 2767 | - this property does not reflect whether the data has been flush. For that | ||
| 2768 | - purpose, use `message.writableFinished` instead. | ||
| 2764 | + Is `true` if `outgoingMessage.end()` has been called. This property does | ||
| 2765 | + not indicate whether the data has been flushed. For that purpose, use | ||
| 2766 | + `message.writableFinished` instead. | ||
| 2769 | 2767 | ||
| 2770 | 2768 | ### `outgoingMessage.writableFinished` | |
| 2771 | 2769 | ||
@@ -2775,7 +2773,7 @@ added: v12.7.0 | |||
| 2775 | 2773 | ||
| 2776 | 2774 | * {boolean} | |
| 2777 | 2775 | ||
| 2778 | - Readonly. `true` if all data has been flushed to the underlying system. | ||
| 2776 | + Is `true` if all data has been flushed to the underlying system. | ||
| 2779 | 2777 | ||
| 2780 | 2778 | ### `outgoingMessage.writableHighWaterMark` | |
| 2781 | 2779 | ||
@@ -2785,12 +2783,8 @@ added: v12.9.0 | |||
| 2785 | 2783 | ||
| 2786 | 2784 | * {number} | |
| 2787 | 2785 | ||
| 2788 | - This `outgoingMessage.writableHighWaterMark` will be the `highWaterMark` of | ||
| 2789 | - underlying socket if socket exists. Else, it would be the default | ||
| 2790 | - `highWaterMark`. | ||
| 2791 | - | ||
| 2792 | - `highWaterMark` is the maximum amount of data that can be potentially | ||
| 2793 | - buffered by the socket. | ||
| 2786 | + The `highWaterMark` of the underlying socket if assigned. Otherwise, the default | ||
| 2787 | + buffer level when [`writable.write()`][] starts returning false (`16384`). | ||
| 2794 | 2788 | ||
| 2795 | 2789 | ### `outgoingMessage.writableLength` | |
| 2796 | 2790 | ||
@@ -2800,8 +2794,7 @@ added: v12.9.0 | |||
| 2800 | 2794 | ||
| 2801 | 2795 | * {number} | |
| 2802 | 2796 | ||
| 2803 | - Readonly, This `outgoingMessage.writableLength` contains the number of | ||
| 2804 | - bytes (or objects) in the buffer ready to send. | ||
| 2797 | + The number of buffered bytes. | ||
| 2805 | 2798 | ||
| 2806 | 2799 | ### `outgoingMessage.writableObjectMode` | |
| 2807 | 2800 | ||
@@ -2811,51 +2804,33 @@ added: v12.9.0 | |||
| 2811 | 2804 | ||
| 2812 | 2805 | * {boolean} | |
| 2813 | 2806 | ||
| 2814 | - Readonly, always returns `false`. | ||
| 2807 | + Always `false`. | ||
| 2815 | 2808 | ||
| 2816 | 2809 | ### `outgoingMessage.write(chunk[, encoding][, callback])` | |
| 2817 | 2810 | ||
| 2818 | 2811 | <!-- YAML | |
| 2819 | 2812 | added: v0.1.29 | |
| 2820 | 2813 | changes: | |
| 2821 | 2814 | - version: v0.11.6 | |
| 2822 | - description: add `callback` argument. | ||
| 2815 | + description: The `callback` argument was added. | ||
| 2823 | 2816 | --> | |
| 2824 | 2817 | ||
| 2825 | 2818 | * `chunk` {string | Buffer} | |
| 2826 | 2819 | * `encoding` {string} **Default**: `utf8` | |
| 2827 | 2820 | * `callback` {Function} | |
| 2828 | 2821 | * Returns {boolean} | |
| 2829 | 2822 | ||
| 2830 | - If this method is called and the header is not sent, it will call | ||
| 2831 | - `this._implicitHeader` to flush implicit header. | ||
| 2832 | - If the message should not have a body (indicated by `this._hasBody`), | ||
| 2833 | - the call is ignored and `chunk` will not be sent. It could be useful | ||
| 2834 | - when handling a particular message which must not include a body. | ||
| 2835 | - e.g. response to `HEAD` request, `204` and `304` response. | ||
| 2823 | + Sends a chunk of the body. This method can be called multiple times. | ||
| 2836 | 2824 | ||
| 2837 | - `chunk` can be a string or a buffer. When `chunk` is a string, the | ||
| 2838 | - `encoding` parameter specifies how to encode `chunk` into a byte stream. | ||
| 2839 | - `callback` will be called when the `chunk` is flushed. | ||
| 2825 | + The `encoding` argument is only relevant when `chunk` is a string. Defaults to | ||
| 2826 | + `'utf8'`. | ||
| 2840 | 2827 | ||
| 2841 | - If the message is transferred in chucked encoding | ||
| 2842 | - (indicated by `this.chunkedEncoding`), `chunk` will be flushed as | ||
| 2843 | - one chunk among a stream of chunks. Otherwise, it will be flushed as the | ||
| 2844 | - body of message. | ||
| 2845 | - | ||
| 2846 | - This method handles the raw body of the HTTP message and has nothing to do | ||
| 2847 | - with higher-level multi-part body encodings that may be used. | ||
| 2848 | - | ||
| 2849 | - If it is the first call to this method of a message, it will send the | ||
| 2850 | - buffered header first, then flush the `chunk` as described above. | ||
| 2851 | - | ||
| 2852 | - The second and successive calls to this method will assume the data | ||
| 2853 | - will be streamed and send the new data separately. It means that the response | ||
| 2854 | - is buffered up to the first chunk of the body. | ||
| 2828 | + The `callback` argument is optional and will be called when this chunk of data | ||
| 2829 | + is flushed. | ||
| 2855 | 2830 | ||
| 2856 | 2831 | Returns `true` if the entire data was flushed successfully to the kernel | |
| 2857 | 2832 | buffer. Returns `false` if all or part of the data was queued in the user | |
| 2858 | - memory. Event `drain` will be emitted when the buffer is free again. | ||
| 2833 | + memory. The `'drain'` event will be emitted when the buffer is free again. | ||
| 2859 | 2834 | ||
| 2860 | 2835 | ## `http.METHODS` | |
| 2861 | 2836 | ||
@@ -3542,4 +3517,5 @@ try { | |||
| 3542 | 3517 | [`writable.destroy()`]: stream.md#writabledestroyerror | |
| 3543 | 3518 | [`writable.destroyed`]: stream.md#writabledestroyed | |
| 3544 | 3519 | [`writable.uncork()`]: stream.md#writableuncork | |
| 3520 | + [`writable.write()`]: stream.md#writablewritechunk-encoding-callback | ||
| 3545 | 3521 | [initial delay]: net.md#socketsetkeepaliveenable-initialdelay | |
| Back | FazBrowse Home | New Git URL |
0 commit comments