| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2441,8 +2441,8 @@ added: v0.1.17 | |||
| 2441 | 2441 | * Extends: {Stream} | |
| 2442 | 2442 | ||
| 2443 | 2443 | This class serves as the parent class of [`http.ClientRequest`][] | |
| 2444 | - and [`http.ServerResponse`][]. It is an abstract of outgoing message from | ||
| 2445 | - the perspective of the participants of HTTP transaction. | ||
| 2444 | + and [`http.ServerResponse`][]. It is an abstract outgoing message from | ||
| 2445 | + the perspective of the participants of an HTTP transaction. | ||
| 2446 | 2446 | ||
| 2447 | 2447 | ### Event: `'drain'` | |
| 2448 | 2448 | ||
@@ -2466,7 +2466,7 @@ Emitted when the transmission is finished successfully. | |||
| 2466 | 2466 | added: v0.11.6 | |
| 2467 | 2467 | --> | |
| 2468 | 2468 | ||
| 2469 | - Emitted when `outgoingMessage.end` was called. | ||
| 2469 | + Emitted after `outgoingMessage.end()` is called. | ||
| 2470 | 2470 | When the event is emitted, all data has been processed but not necessarily | |
| 2471 | 2471 | completely flushed. | |
| 2472 | 2472 | ||
@@ -2480,11 +2480,11 @@ added: v0.3.0 | |||
| 2480 | 2480 | ||
| 2481 | 2481 | Adds HTTP trailers (headers but at the end of the message) to the message. | |
| 2482 | 2482 | ||
| 2483 | - Trailers are **only** be emitted if the message is chunked encoded. If not, | ||
| 2484 | - the trailer will be silently discarded. | ||
| 2483 | + Trailers will **only** be emitted if the message is chunked encoded. If not, | ||
| 2484 | + the trailers will be silently discarded. | ||
| 2485 | 2485 | ||
| 2486 | 2486 | HTTP requires the `Trailer` header to be sent to emit trailers, | |
| 2487 | - with a list of header fields in its value, e.g. | ||
| 2487 | + with a list of header field names in its value, e.g. | ||
| 2488 | 2488 | ||
| 2489 | 2489 | ```js | |
| 2490 | 2490 | message.writeHead(200, { 'Content-Type': 'text/plain', | |
@@ -2506,7 +2506,7 @@ deprecated: v15.12.0 | |||
| 2506 | 2506 | ||
| 2507 | 2507 | > Stability: 0 - Deprecated: Use [`outgoingMessage.socket`][] instead. | |
| 2508 | 2508 | ||
| 2509 | - Aliases of `outgoingMessage.socket` | ||
| 2509 | + Alias of [`outgoingMessage.socket`][]. | ||
| 2510 | 2510 | ||
| 2511 | 2511 | ### `outgoingMessage.cork()` | |
| 2512 | 2512 | ||
@@ -2546,22 +2546,22 @@ changes: | |||
| 2546 | 2546 | ||
| 2547 | 2547 | Finishes the outgoing message. If any parts of the body are unsent, it will | |
| 2548 | 2548 | flush them to the underlying system. If the message is chunked, it will | |
| 2549 | - send the terminating chunk `0\r\n\r\n`, and send the trailer (if any). | ||
| 2549 | + send the terminating chunk `0\r\n\r\n`, and send the trailers (if any). | ||
| 2550 | 2550 | ||
| 2551 | - If `chunk` is specified, it is equivalent to call | ||
| 2551 | + If `chunk` is specified, it is equivalent to calling | ||
| 2552 | 2552 | `outgoingMessage.write(chunk, encoding)`, followed by | |
| 2553 | 2553 | `outgoingMessage.end(callback)`. | |
| 2554 | 2554 | ||
| 2555 | - If `callback` is provided, it will be called when the message is finished. | ||
| 2556 | - (equivalent to the callback to event `finish`) | ||
| 2555 | + If `callback` is provided, it will be called when the message is finished | ||
| 2556 | + (equivalent to a listener of the `'finish'` event). | ||
| 2557 | 2557 | ||
| 2558 | 2558 | ### `outgoingMessage.flushHeaders()` | |
| 2559 | 2559 | ||
| 2560 | 2560 | <!-- YAML | |
| 2561 | 2561 | added: v1.6.0 | |
| 2562 | 2562 | --> | |
| 2563 | 2563 | ||
| 2564 | - Compulsorily flushes the message headers | ||
| 2564 | + Flushes the message headers. | ||
| 2565 | 2565 | ||
| 2566 | 2566 | For efficiency reason, Node.js normally buffers the message headers | |
| 2567 | 2567 | until `outgoingMessage.end()` is called or the first chunk of message data | |
@@ -2570,7 +2570,7 @@ packet. | |||
| 2570 | 2570 | ||
| 2571 | 2571 | It is usually desired (it saves a TCP round-trip), but not when the first | |
| 2572 | 2572 | data is not sent until possibly much later. `outgoingMessage.flushHeaders()` | |
| 2573 | - bypasses the optimization and kickstarts the request. | ||
| 2573 | + bypasses the optimization and kickstarts the message. | ||
| 2574 | 2574 | ||
| 2575 | 2575 | ### `outgoingMessage.getHeader(name)` | |
| 2576 | 2576 | ||
@@ -2581,8 +2581,8 @@ added: v0.4.0 | |||
| 2581 | 2581 | * `name` {string} Name of header | |
| 2582 | 2582 | * Returns {string | undefined} | |
| 2583 | 2583 | ||
| 2584 | - Gets the value of HTTP header with the given name. If such a name doesn't | ||
| 2585 | - exist in message, it will be `undefined`. | ||
| 2584 | + Gets the value of the HTTP header with the given name. If that header is not | ||
| 2585 | + set, the returned value will be `undefined`. | ||
| 2586 | 2586 | ||
| 2587 | 2587 | ### `outgoingMessage.getHeaderNames()` | |
| 2588 | 2588 | ||
@@ -2592,8 +2592,8 @@ added: v7.7.0 | |||
| 2592 | 2592 | ||
| 2593 | 2593 | * Returns {string\[]} | |
| 2594 | 2594 | ||
| 2595 | - Returns an array of names of headers of the outgoing outgoingMessage. All | ||
| 2596 | - names are lowercase. | ||
| 2595 | + Returns an array containing the unique names of the current outgoing headers. | ||
| 2596 | + All names are lowercase. | ||
| 2597 | 2597 | ||
| 2598 | 2598 | ### `outgoingMessage.getHeaders()` | |
| 2599 | 2599 | ||
@@ -2610,8 +2610,8 @@ object are the header names and the values are the respective header | |||
| 2610 | 2610 | values. All header names are lowercase. | |
| 2611 | 2611 | ||
| 2612 | 2612 | The object returned by the `outgoingMessage.getHeaders()` method does | |
| 2613 | - not prototypically inherit from the JavaScript Object. This means that | ||
| 2614 | - typical Object methods such as `obj.toString()`, `obj.hasOwnProperty()`, | ||
| 2613 | + not prototypically inherit from the JavaScript `Object`. This means that | ||
| 2614 | + typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, | ||
| 2615 | 2615 | and others are not defined and will not work. | |
| 2616 | 2616 | ||
| 2617 | 2617 | ```js | |
@@ -2654,14 +2654,11 @@ Read-only. `true` if the headers were sent, otherwise `false`. | |||
| 2654 | 2654 | added: v9.0.0 | |
| 2655 | 2655 | --> | |
| 2656 | 2656 | ||
| 2657 | - Overrides the pipe method of legacy `Stream` which is the parent class of | ||
| 2658 | - `http.outgoingMessage`. | ||
| 2659 | - | ||
| 2660 | - Since `OutgoingMessage` should be a write-only stream, | ||
| 2661 | - call this function will throw an `Error`. Thus, it disabled the pipe method | ||
| 2662 | - it inherits from `Stream`. | ||
| 2657 | + Overrides the `stream.pipe()` method inherited from the legacy `Stream` class | ||
| 2658 | + which is the parent class of `http.OutgoingMessage`. | ||
| 2663 | 2659 | ||
| 2664 | - The User should not call this function directly. | ||
| 2660 | + Calling this method will throw an `Error` because `outgoingMessage` is a | ||
| 2661 | + write-only stream. | ||
| 2665 | 2662 | ||
| 2666 | 2663 | ### `outgoingMessage.removeHeader(name)` | |
| 2667 | 2664 | ||
@@ -2684,10 +2681,12 @@ added: v0.4.0 | |||
| 2684 | 2681 | --> | |
| 2685 | 2682 | ||
| 2686 | 2683 | * `name` {string} Header name | |
| 2687 | - * `value` {string} Header value | ||
| 2684 | + * `value` {any} Header value | ||
| 2688 | 2685 | * Returns: {this} | |
| 2689 | 2686 | ||
| 2690 | - Sets a single header value for the header object. | ||
| 2687 | + Sets a single header value. If the header already exists in the to-be-sent | ||
| 2688 | + headers, its value will be replaced. Use an array of strings to send multiple | ||
| 2689 | + headers with the same name. | ||
| 2691 | 2690 | ||
| 2692 | 2691 | ### `outgoingMessage.setTimeout(msesc[, callback])` | |
| 2693 | 2692 | ||
@@ -2736,8 +2735,7 @@ added: | |||
| 2736 | 2735 | ||
| 2737 | 2736 | * {number} | |
| 2738 | 2737 | ||
| 2739 | - This `outgoingMessage.writableCorked` will return the time how many | ||
| 2740 | - `outgoingMessage.cork()` have been called. | ||
| 2738 | + The number of times `outgoingMessage.cork()` has been called. | ||
| 2741 | 2739 | ||
| 2742 | 2740 | ### `outgoingMessage.writableEnded` | |
| 2743 | 2741 | ||
@@ -2747,9 +2745,9 @@ added: v12.9.0 | |||
| 2747 | 2745 | ||
| 2748 | 2746 | * {boolean} | |
| 2749 | 2747 | ||
| 2750 | - Readonly, `true` if `outgoingMessage.end()` has been called. Noted that | ||
| 2751 | - this property does not reflect whether the data has been flush. For that | ||
| 2752 | - purpose, use `message.writableFinished` instead. | ||
| 2748 | + Is `true` if `outgoingMessage.end()` has been called. This property does | ||
| 2749 | + not indicate whether the data has been flushed. For that purpose, use | ||
| 2750 | + `message.writableFinished` instead. | ||
| 2753 | 2751 | ||
| 2754 | 2752 | ### `outgoingMessage.writableFinished` | |
| 2755 | 2753 | ||
@@ -2759,7 +2757,7 @@ added: v12.7.0 | |||
| 2759 | 2757 | ||
| 2760 | 2758 | * {boolean} | |
| 2761 | 2759 | ||
| 2762 | - Readonly. `true` if all data has been flushed to the underlying system. | ||
| 2760 | + Is `true` if all data has been flushed to the underlying system. | ||
| 2763 | 2761 | ||
| 2764 | 2762 | ### `outgoingMessage.writableHighWaterMark` | |
| 2765 | 2763 | ||
@@ -2769,12 +2767,8 @@ added: v12.9.0 | |||
| 2769 | 2767 | ||
| 2770 | 2768 | * {number} | |
| 2771 | 2769 | ||
| 2772 | - This `outgoingMessage.writableHighWaterMark` will be the `highWaterMark` of | ||
| 2773 | - underlying socket if socket exists. Else, it would be the default | ||
| 2774 | - `highWaterMark`. | ||
| 2775 | - | ||
| 2776 | - `highWaterMark` is the maximum amount of data that can be potentially | ||
| 2777 | - buffered by the socket. | ||
| 2770 | + The `highWaterMark` of the underlying socket if assigned. Otherwise, the default | ||
| 2771 | + buffer level when [`writable.write()`][] starts returning false (`16384`). | ||
| 2778 | 2772 | ||
| 2779 | 2773 | ### `outgoingMessage.writableLength` | |
| 2780 | 2774 | ||
@@ -2784,8 +2778,7 @@ added: v12.9.0 | |||
| 2784 | 2778 | ||
| 2785 | 2779 | * {number} | |
| 2786 | 2780 | ||
| 2787 | - Readonly, This `outgoingMessage.writableLength` contains the number of | ||
| 2788 | - bytes (or objects) in the buffer ready to send. | ||
| 2781 | + The number of buffered bytes. | ||
| 2789 | 2782 | ||
| 2790 | 2783 | ### `outgoingMessage.writableObjectMode` | |
| 2791 | 2784 | ||
@@ -2795,51 +2788,33 @@ added: v12.9.0 | |||
| 2795 | 2788 | ||
| 2796 | 2789 | * {boolean} | |
| 2797 | 2790 | ||
| 2798 | - Readonly, always returns `false`. | ||
| 2791 | + Always `false`. | ||
| 2799 | 2792 | ||
| 2800 | 2793 | ### `outgoingMessage.write(chunk[, encoding][, callback])` | |
| 2801 | 2794 | ||
| 2802 | 2795 | <!-- YAML | |
| 2803 | 2796 | added: v0.1.29 | |
| 2804 | 2797 | changes: | |
| 2805 | 2798 | - version: v0.11.6 | |
| 2806 | - description: add `callback` argument. | ||
| 2799 | + description: The `callback` argument was added. | ||
| 2807 | 2800 | --> | |
| 2808 | 2801 | ||
| 2809 | 2802 | * `chunk` {string | Buffer} | |
| 2810 | 2803 | * `encoding` {string} **Default**: `utf8` | |
| 2811 | 2804 | * `callback` {Function} | |
| 2812 | 2805 | * Returns {boolean} | |
| 2813 | 2806 | ||
| 2814 | - If this method is called and the header is not sent, it will call | ||
| 2815 | - `this._implicitHeader` to flush implicit header. | ||
| 2816 | - If the message should not have a body (indicated by `this._hasBody`), | ||
| 2817 | - the call is ignored and `chunk` will not be sent. It could be useful | ||
| 2818 | - when handling a particular message which must not include a body. | ||
| 2819 | - e.g. response to `HEAD` request, `204` and `304` response. | ||
| 2807 | + Sends a chunk of the body. This method can be called multiple times. | ||
| 2820 | 2808 | ||
| 2821 | - `chunk` can be a string or a buffer. When `chunk` is a string, the | ||
| 2822 | - `encoding` parameter specifies how to encode `chunk` into a byte stream. | ||
| 2823 | - `callback` will be called when the `chunk` is flushed. | ||
| 2809 | + The `encoding` argument is only relevant when `chunk` is a string. Defaults to | ||
| 2810 | + `'utf8'`. | ||
| 2824 | 2811 | ||
| 2825 | - If the message is transferred in chucked encoding | ||
| 2826 | - (indicated by `this.chunkedEncoding`), `chunk` will be flushed as | ||
| 2827 | - one chunk among a stream of chunks. Otherwise, it will be flushed as the | ||
| 2828 | - body of message. | ||
| 2829 | - | ||
| 2830 | - This method handles the raw body of the HTTP message and has nothing to do | ||
| 2831 | - with higher-level multi-part body encodings that may be used. | ||
| 2832 | - | ||
| 2833 | - If it is the first call to this method of a message, it will send the | ||
| 2834 | - buffered header first, then flush the `chunk` as described above. | ||
| 2835 | - | ||
| 2836 | - The second and successive calls to this method will assume the data | ||
| 2837 | - will be streamed and send the new data separately. It means that the response | ||
| 2838 | - is buffered up to the first chunk of the body. | ||
| 2812 | + The `callback` argument is optional and will be called when this chunk of data | ||
| 2813 | + is flushed. | ||
| 2839 | 2814 | ||
| 2840 | 2815 | Returns `true` if the entire data was flushed successfully to the kernel | |
| 2841 | 2816 | buffer. Returns `false` if all or part of the data was queued in the user | |
| 2842 | - memory. Event `drain` will be emitted when the buffer is free again. | ||
| 2817 | + memory. The `'drain'` event will be emitted when the buffer is free again. | ||
| 2843 | 2818 | ||
| 2844 | 2819 | ## `http.METHODS` | |
| 2845 | 2820 | ||
@@ -3498,4 +3473,5 @@ try { | |||
| 3498 | 3473 | [`writable.destroy()`]: stream.md#writabledestroyerror | |
| 3499 | 3474 | [`writable.destroyed`]: stream.md#writabledestroyed | |
| 3500 | 3475 | [`writable.uncork()`]: stream.md#writableuncork | |
| 3476 | + [`writable.write()`]: stream.md#writablewritechunk-encoding-callback | ||
| 3501 | 3477 | [initial delay]: net.md#socketsetkeepaliveenable-initialdelay | |
| Back | FazBrowse Home | New Git URL |
0 commit comments