| 323 | const url = new URL(request.body.url); | 323 | const url = new URL(request.body.url); |
| 324 | url.pathname = '/sdapi/v1/txt2img'; | 324 | url.pathname = '/sdapi/v1/txt2img'; |
| 325 | | 325 | |
| | 326 | const controller = new AbortController(); |
| | 327 | request.socket.removeAllListeners('close'); |
| | 328 | request.socket.on('close', function () { |
| | 329 | if (!response.writableEnded) { |
| | 330 | const url = new URL(request.body.url); |
| | 331 | url.pathname = '/sdapi/v1/interrupt'; |
| | 332 | fetch(url, { method: 'POST', headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } }); |
| | 333 | } |
| | 334 | controller.abort(); |
| | 335 | }); |
| | 336 | |
| 326 | const result = await fetch(url, { | 337 | const result = await fetch(url, { |
| 327 | method: 'POST', | 338 | method: 'POST', |
| 328 | body: JSON.stringify(request.body), | 339 | body: JSON.stringify(request.body), |