You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe("should work and generate strong etag without createReadStream",()=>{
5358
5458
beforeEach(async()=>{
5359
5459
constcompiler=getCompiler(webpackConfig);
@@ -5593,6 +5693,103 @@ describe.each([
5593
5693
expect(response2.headers.etag).toBeDefined();
5594
5694
});
5595
5695
});
5696
+
5697
+
describe("should work and generate etag with other middlewares",()=>{
5698
+
beforeAll(async()=>{
5699
+
constcompiler=getCompiler(webpackConfig);
5700
+
5701
+
letisFirstRequest=true;
5702
+
5703
+
[server,req,instance]=awaitframeworkFactory(
5704
+
name,
5705
+
framework,
5706
+
compiler,
5707
+
{
5708
+
lastModified: true,
5709
+
},
5710
+
{
5711
+
setupMiddlewares: (middlewares)=>{
5712
+
if(name==="koa"){
5713
+
middlewares.push(async(ctx,next)=>{
5714
+
awaitnext();
5715
+
5716
+
if(!isFirstRequest){
5717
+
ctx.status=500;
5718
+
ctx.body="shouldn't get there";
5719
+
}
5720
+
5721
+
isFirstRequest=false;
5722
+
});
5723
+
}elseif(name==="hapi"){
5724
+
middlewares.push({
5725
+
plugin: {
5726
+
name: "myPlugin",
5727
+
version: "1.0.0",
5728
+
register(innerServer){
5729
+
innerServer.ext("onRequest",()=>{
5730
+
if(!isFirstRequest){
5731
+
thrownewError("shouldn't get there");
5732
+
}
5733
+
5734
+
isFirstRequest=false;
5735
+
});
5736
+
},
5737
+
},
5738
+
});
5739
+
}elseif(name==="hono"){
5740
+
middlewares.push(async(c,next)=>{
5741
+
awaitnext();
5742
+
5743
+
if(!isFirstRequest){
5744
+
thrownewError("shouldn't get there");
5745
+
}
5746
+
5747
+
isFirstRequest=false;
5748
+
});
5749
+
}else{
5750
+
middlewares.push(async(req,res,next)=>{
5751
+
if(!isFirstRequest){
5752
+
next(newError("shouldn't get there"));
5753
+
return;
5754
+
}
5755
+
5756
+
isFirstRequest=false;
5757
+
5758
+
next();
5759
+
});
5760
+
}
5761
+
5762
+
returnmiddlewares;
5763
+
},
5764
+
},
5765
+
);
5766
+
});
5767
+
5768
+
afterAll(async()=>{
5769
+
awaitclose(server,instance);
5770
+
});
5771
+
5772
+
it('should return the "304" code for the "GET" request to the bundle file with lastModified and "if-modified-since" header with additional middlewares',async()=>{
0 commit comments