UNPKG

@foxglove/ros1

Version:

Standalone TypeScript implementation of the ROS 1 (Robot Operating System) protocol with a pluggable transport layer

29 lines 887 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MockHttpServer = void 0; class MockHttpServer { constructor(defaultHost, defaultPort) { this.handler = async (_req) => ({ statusCode: 404 }); this._defaultHost = defaultHost; this._defaultPort = defaultPort; } url() { if (this._hostname == undefined || this._port == undefined) { return undefined; } return `http://${this._hostname}:${this._port}/`; } port() { return this._port; } async listen(port, hostname, _backlog) { this._port = port ?? this._defaultPort; this._hostname = hostname ?? this._defaultHost; } close() { this._port = undefined; this._hostname = undefined; } } exports.MockHttpServer = MockHttpServer; //# sourceMappingURL=MockHttpServer.js.map