Skip to content

Commit

Permalink
fix: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
liximomo committed Jun 30, 2020
1 parent 845bf0b commit eab0dcd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/shuvi/src/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { UrlWithParsedQuery } from 'url';
import { Server, NextFunction } from 'connect';

export interface IIncomingMessage extends http.IncomingMessage {
url: string;
parsedUrl: UrlWithParsedQuery;
originalUrl?: http.IncomingMessage['url'];
[x: string]: any;
Expand Down
9 changes: 4 additions & 5 deletions packages/shuvi/src/shuvi/shuvi.base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IShuviMode, APIHooks, Runtime } from '@shuvi/types';
import { ServerResponse } from 'http';
import {
IHTTPRequestHandler,
IIncomingMessage,
Expand Down Expand Up @@ -34,13 +35,11 @@ export default abstract class Shuvi {
}

async renderToHTML(
req: IIncomingMessage,
res: IServerResponse
req: Runtime.IRequest,
res: ServerResponse
): Promise<string | null> {
req.url = req.url || '/';
const renderRequest = req as Runtime.IRequest;
return renderToHTML({
req: renderRequest,
req,
api: this._api,
onRedirect(redirect) {
res.writeHead(redirect.status ?? 302, { Location: redirect.path });
Expand Down

0 comments on commit eab0dcd

Please sign in to comment.