/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import http from 'http'; export type ServerRouteHandler = (request: http.IncomingMessage, response: http.ServerResponse) => void; export type Transport = { sendEvent?: (method: string, params: any) => void; close?: () => void; onconnect: () => void; dispatch: (method: string, params: any) => Promise; onclose: () => void; }; export declare class HttpServer { private _server; private _urlPrefixPrecise; private _urlPrefixHumanReadable; private _port; private _routes; constructor(); server(): http.Server; routePrefix(prefix: string, handler: ServerRouteHandler): void; routePath(path: string, handler: ServerRouteHandler): void; port(): number; private _tryStart; start(options?: { port?: number; preferredPort?: number; host?: string; }): Promise; stop(): Promise; urlPrefix(purpose: 'human-readable' | 'precise'): string; serveFile(request: http.IncomingMessage, response: http.ServerResponse, absoluteFilePath: string, headers?: { [name: string]: string; }): boolean; _serveFile(response: http.ServerResponse, absoluteFilePath: string): void; _serveRangeFile(request: http.IncomingMessage, response: http.ServerResponse, absoluteFilePath: string): http.ServerResponse | undefined; private _onRequest; }