| 20 | private _url?: string; |
| 21 | |
| 22 | constructor(options: MockCdnOptions) { |
| 23 | this.packages = options.packages; |
| 24 | |
| 25 | this.app = setupApp(); |
| 26 | this.app.log.level = 'error'; |
| 27 | |
| 28 | this.app.get('/', (req, res) => { |
| 29 | res.send(`This is a mock CDN for testing purposes.`); |
| 30 | }); |
| 31 | this.app.get('/v2/deps/:query', this.dependencyQueryMiddleware.bind(this)); |
| 32 | this.app.get('/v2/mod/:query', this.moduleQueryMiddleware.bind(this)); |
| 33 | } |
| 34 | |
| 35 | private respondWith(res: FastifyReply, data: unknown) { |
| 36 | res.type('application/octet-stream'); |