(headersParam, options)
| 1817 | // Submits a new HTTP2 request to the connected peer. Returns the |
| 1818 | // associated Http2Stream instance. |
| 1819 | request(headersParam, options) { |
| 1820 | debugSessionObj(this, 'initiating request'); |
| 1821 | |
| 1822 | // Keep argument validation synchronous, but defer session-state failures |
| 1823 | // to the returned stream so request retries from stream callbacks do not |
| 1824 | // throw before session lifecycle handlers run. |
| 1825 | let requestError; |
| 1826 | if (this.destroyed) { |
| 1827 | requestError = new ERR_HTTP2_INVALID_SESSION(); |
| 1828 | } else if (this.closed) { |
| 1829 | requestError = new ERR_HTTP2_GOAWAY_SESSION(); |
| 1830 | } |
| 1831 | |
| 1832 | this[kUpdateTimer](); |
| 1833 | |
| 1834 | let headersList; |
| 1835 | let headersObject; |
| 1836 | let rawHeaders; |
| 1837 | let scheme; |
| 1838 | let authority; |
| 1839 | let method; |
| 1840 | |
| 1841 | if (ArrayIsArray(headersParam)) { |
| 1842 | ({ |
| 1843 | rawHeaders, |
| 1844 | headersList, |
| 1845 | scheme, |
| 1846 | authority, |
| 1847 | method, |
| 1848 | } = prepareRequestHeadersArray(headersParam, this)); |
| 1849 | } else if (!!headersParam && typeof headersParam === 'object') { |
| 1850 | ({ |
| 1851 | headersObject, |
| 1852 | headersList, |
| 1853 | scheme, |
| 1854 | authority, |
| 1855 | method, |
| 1856 | } = prepareRequestHeadersObject(headersParam, this)); |
| 1857 | } else if (headersParam === undefined) { |
| 1858 | ({ |
| 1859 | headersObject, |
| 1860 | headersList, |
| 1861 | scheme, |
| 1862 | authority, |
| 1863 | method, |
| 1864 | } = prepareRequestHeadersObject({}, this)); |
| 1865 | } else { |
| 1866 | throw new ERR_INVALID_ARG_TYPE.HideStackFramesError( |
| 1867 | 'headers', |
| 1868 | ['Object', 'Array'], |
| 1869 | headersParam, |
| 1870 | ); |
| 1871 | } |
| 1872 | |
| 1873 | assertIsObject(options, 'options'); |
| 1874 | options = { ...options }; |
| 1875 | |
| 1876 | setAndValidatePriorityOptions(options); |
nothing calls this directly
no test coverage detected