ProjectEvergreen / greenwood

Greenwood is your workbench for the web, embracing web standards from the ground up to empower your stack from front to back.
https://www.greenwoodjs.io
MIT License
96 stars 9 forks source link

bug/issue 1108 update ETag caching to work with ReadableStreams #1109

Closed thescientist13 closed 1 year ago

thescientist13 commented 1 year ago

Related Issue

resolves #1108

https://github.com/ProjectEvergreen/greenwood/assets/895923/24c2361e-4c53-4d24-a195-416036699f5d

Summary of Changes

  1. Update ETag implementation to work with ReadableStream
  2. Removed "filter" around binary files, will now work with any file: types
  3. Add test cases to cover etag hits and misses

TODO

  1. [x] Fix spec failing for missing content length

        1) Develop Greenwood With:
         Default Greenwood Configuration and Workspace
           Develop command with generic video container format (.mp4) behavior
             should return the correct content length:
       AssertionError: expected undefined to equal '2498461'
        at Context. (file:///Users/owenbuckley/Workspace/project-evergreen/repos/greenwood/packages/cli/test/cases/develop.default/develop.default.spec.js:911:55)
        at process.processImmediate (node:internal/timers:471:21)
    
        2) Develop Greenwood With:
             Default Greenwood Configuration and Workspace
               Develop command with audio format (.mp3) behavior
                 should return the correct content length:
           AssertionError: expected undefined to equal '5425061'
            at Context. (file:///Users/owenbuckley/Workspace/project-evergreen/repos/greenwood/packages/cli/test/cases/develop.default/develop.default.spec.js:950:55)
            at process.processImmediate (node:internal/timers:471:21)
      
  2. [x] Add test case for etag header
  3. [x] Finalize testing / clean up consoles and comments
  4. [x] Probably a good idea to make sure this and the disable cache work around are documented somewhere - already covered! - http://localhost:1984/about/how-it-works/#cli