7f26b17652
* Improve error message when using invalid client_id during code exchange * Extract SPA example OAuth client in own package * wip * remove dependency on get-port * Properly configure jest to only transpile "get-port" from node_modules https://jestjs.io/docs/configuration#transformignorepatterns-arraystring * Use dynamically assigned port number during tests * use puppeteer to run tests * remove login input "id" attribute * code style * add missing declaration * tidy * headless * remove get-port dependency * fix tests/proxied/admin.test.ts * fix tests * Allow unsecure oauth providers through configuration * transpile "lande" during ozone tests * Cache Puppeteer browser binaries * Use puppeteer cache during all workflow steps * remove use of set-output * use get-port in xrpc-server tests * Renamed to allowHttp * tidy * tidy
22 lines
487 B
TypeScript
22 lines
487 B
TypeScript
import { once } from 'node:events'
|
|
import { createServer } from 'node:http'
|
|
|
|
export async function createHeaderEchoServer(port: number = 0) {
|
|
const server = createServer((req, res) => {
|
|
res.writeHead(200, undefined, { 'content-type': 'application/json' })
|
|
res.end(
|
|
JSON.stringify({
|
|
...req.headers,
|
|
did: 'did:web:fake.com',
|
|
availableUserDomains: [],
|
|
}),
|
|
)
|
|
})
|
|
|
|
server.listen(port)
|
|
|
|
await once(server, 'listening')
|
|
|
|
return server
|
|
}
|