Files
insomnia/packages/insomnia-test/misc/server/github-api.ts
T
Bob QiuandClaude Sonnet 5.5 55f97f3f9c refactor(insomnia-test): replace the standalone mock servers with the smoke-test mock server
Remove the misc/*-server.ts scripts and their per-server webServer entries.
Run a single mock server (misc/server), copied from insomnia-smoke-test and
adapted to native-ESM node (import.meta.dirname, .ts imports, generated
certs, no cross-package imports).

Additions on top of the smoke server: misc/server/mock-api.ts (account and
session state, _admin hooks, Cloud Sync GraphQL, vault, collaborators; runs
as middleware and falls through), an httpbin-style /post, a catch-all 200 {}
and socket.io moved to :3000. HTTP_SERVER now points at the single server.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 11:08:34 +08:00

49 lines
1.1 KiB
TypeScript

import type { Application } from 'express';
export default function setup(app: Application) {
app.get('/github-api/rest/user/repos', (_req, res) => {
res.status(200).send([
{
id: 123_456,
full_name: 'kong-test/sleepless',
clone_url: 'https://github.com/kong-test/sleepless.git',
permissions: {
push: true,
pull: true,
},
},
]);
});
app.get('/github-api/rest/user/emails', (_req, res) => {
res.status(200).send([
{
email: 'curtain@drape.net',
primary: true,
},
]);
});
app.get('/github-api/rest/user', (_req, res) => {
res.status(200).send({
name: 'Insomnia',
login: 'insomnia-infra',
email: null,
avatar_url: 'https://github.com/insomnia-infra.png',
url: 'https://api.github.com/users/insomnia-infra',
});
});
app.post('/v1/oauth/github', (_req, res) => {
res.status(200).send({
access_token: '123456789',
});
});
app.post('/v1/oauth/github-app', (_req, res) => {
res.status(200).send({
access_token: '123456789',
});
});
}