Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/sso-only.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ async function stack({config = () => V2()} = {}) {
await new Promise((r) => remote.listen(0, '127.0.0.1', r))
const req = (port, {method = 'GET', path = '/', headers = {}, body} = {}) =>
new Promise((resolve, reject) => {
const r = http.request({host: '127.0.0.1', port, method, path, headers: {host: HOST, ...headers, ...(body ? {'content-type': 'application/json', 'content-length': Buffer.byteLength(body)} : {})}}, (res) => {
// A fresh connection per request. When the gate closes it destroys every remote socket,
// keep-alive sockets included (server/app.mjs). On Node 26 the client's keep-alive agent can
// hand one of those sockets to the next request before it has read the reset, and that request
// fails with ECONNRESET ("socket hang up"). Node 22 and 24 open a new connection there instead.
const r = http.request({host: '127.0.0.1', port, agent: false, method, path, headers: {host: HOST, ...headers, ...(body ? {'content-type': 'application/json', 'content-length': Buffer.byteLength(body)} : {})}}, (res) => {
let text = ''
res.on('data', (c) => (text += c))
res.on('end', () => resolve({status: res.statusCode, headers: res.headers, text}))
Expand Down