MCPcopy
hub / github.com/langgenius/dify / startTextServer

Function startTextServer

packages/dev-proxy/src/cli.spec.ts:144–163  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

142}
143
144const startTextServer = async (body: string) => {
145 const server = http.createServer((_, response) => {
146 response.writeHead(200, { 'content-type': 'text/plain' })
147 response.end(body)
148 })
149
150 await new Promise<void>((resolve, reject) => {
151 server.once('error', reject)
152 server.listen(0, '127.0.0.1', resolve)
153 })
154
155 const address = server.address()
156 if (!address || typeof address === 'string')
157 throw new Error('Failed to start test server.')
158
159 httpServers.push(server)
160 return {
161 port: address.port,
162 }
163}
164
165describe('dev proxy CLI', () => {
166 afterEach(async () => {

Callers 1

cli.spec.tsFile · 0.85

Calls 4

endMethod · 0.80
addressMethod · 0.80
listenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected