(
req: ServerRequest,
res: ServerResponse,
pathname: string,
query: NextParsedUrlQuery = {},
parsedUrl?: NextUrlWithParsedQuery,
internalRender = false
)
| 1893 | } |
| 1894 | |
| 1895 | private async renderImpl( |
| 1896 | req: ServerRequest, |
| 1897 | res: ServerResponse, |
| 1898 | pathname: string, |
| 1899 | query: NextParsedUrlQuery = {}, |
| 1900 | parsedUrl?: NextUrlWithParsedQuery, |
| 1901 | internalRender = false |
| 1902 | ): Promise<void> { |
| 1903 | if (!pathname.startsWith('/')) { |
| 1904 | console.warn( |
| 1905 | `Cannot render page with path "${pathname}", did you mean "/${pathname}"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash` |
| 1906 | ) |
| 1907 | } |
| 1908 | |
| 1909 | if ( |
| 1910 | this.serverOptions.customServer && |
| 1911 | pathname === '/index' && |
| 1912 | !(await this.hasPage('/index')) |
| 1913 | ) { |
| 1914 | // maintain backwards compatibility for custom server |
| 1915 | // (see custom-server integration tests) |
| 1916 | pathname = '/' |
| 1917 | } |
| 1918 | |
| 1919 | const ua = req.headers['user-agent'] || '' |
| 1920 | this.renderOpts.botType = getBotType(ua) |
| 1921 | |
| 1922 | // we allow custom servers to call render for all URLs |
| 1923 | // so check if we need to serve a static _next file or not. |
| 1924 | // we don't modify the URL for _next/data request but still |
| 1925 | // call render so we special case this to prevent an infinite loop |
| 1926 | if ( |
| 1927 | !internalRender && |
| 1928 | !this.minimalMode && |
| 1929 | !getRequestMeta(req, 'isNextDataReq') && |
| 1930 | (req.url?.match(/^\/_next\//) || |
| 1931 | (this.hasStaticDir && req.url!.match(/^\/static\//))) |
| 1932 | ) { |
| 1933 | return this.handleRequest(req, res, parsedUrl) |
| 1934 | } |
| 1935 | |
| 1936 | if (isBlockedPage(pathname)) { |
| 1937 | return this.render404(req, res, parsedUrl) |
| 1938 | } |
| 1939 | |
| 1940 | return this.pipe((ctx) => this.renderToResponse(ctx), { |
| 1941 | req, |
| 1942 | res, |
| 1943 | pathname, |
| 1944 | query, |
| 1945 | }) |
| 1946 | } |
| 1947 | |
| 1948 | protected async getStaticPaths({ |
| 1949 | pathname, |
nothing calls this directly
no test coverage detected
searching dependent graphs…