Comparing version 1.2.1 to 1.2.2
@@ -177,3 +177,3 @@ "use strict"; | ||
})); | ||
stream.on("streamClosed", guard((errorCode) => { | ||
stream.on("close", guard(() => { | ||
// We'll get an 'error' event if there actually is an | ||
@@ -183,3 +183,3 @@ // error, but not if we got NGHTTP2_NO_ERROR. | ||
// instead, to get (and propagate) the error object. | ||
if (errorCode === NGHTTP2_NO_ERROR) | ||
if (stream.rstCode === NGHTTP2_NO_ERROR) | ||
reject(new core_1.AbortError("Stream prematurely closed")); | ||
@@ -186,0 +186,0 @@ })); |
@@ -1,1 +0,1 @@ | ||
export declare const version = "1.2.1"; | ||
export declare const version = "1.2.2"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "1.2.1"; | ||
exports.version = "1.2.2"; | ||
//# sourceMappingURL=version.js.map |
@@ -423,2 +423,17 @@ "use strict"; | ||
}); | ||
describe("premature stream close", () => { | ||
it("handle and reject fetch operation", async () => { | ||
const { server, port } = await server_1.makeServer(); | ||
const url = `http://localhost:${port}/prem-close`; | ||
try { | ||
await __1.fetch(url); | ||
chai_1.expect(false).to.equal(true); | ||
} | ||
catch (err) { | ||
chai_1.expect(err.message).to.contain("Stream prematurely closed"); | ||
} | ||
await __1.disconnectAll(); | ||
await server.shutdown(); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -214,2 +214,5 @@ "use strict"; | ||
} | ||
else if (path.startsWith("/prem-close")) { | ||
stream.close(); | ||
} | ||
else { | ||
@@ -216,0 +219,0 @@ const matched = (this._opts.matchers || []) |
{ | ||
"name": "fetch-h2", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "HTTP/2-only Fetch API client for Node.js", | ||
@@ -5,0 +5,0 @@ "author": "Gustaf Räntilä", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
223302
2798