Coder Social home page Coder Social logo

Comments (4)

mekanoe avatar mekanoe commented on August 29, 2024
  fileResponse = new Response(`Success!`, { status: 200 });

This is hyper-suspect, I'm betting that normalizeHeaders is assuming headers are always set, but isn't at all in this case. If you set headers to an empty object in the response init object, does it resolve it as a workaround?

from miniflare.

TimTinkers avatar TimTinkers commented on August 29, 2024

That value is never being fed to the cache. In the code above I do explicitly add headers using modifyHeaders.

fileResponse = new Response(fileResponse.body, {
      status: fileResponse.status,
      statusText: fileResponse.statusText,
      headers: processedHeaders
    });

from miniflare.

mrbbot avatar mrbbot commented on August 29, 2024

Hello again! 👋 This issue here is that Miniflare's Cache doesn't support using URL objects as cache keys, so...

const url = new URL(req.url);
// ...
cache.put(url, new Response(...))

...isn't behaving properly. As per the spec (https://w3c.github.io/ServiceWorker/#cache-put) this should work though, so I'll fix this.

Is this caching working on Cloudflare by the way? I think as you're not setting any Cache-Control headers, nothing will actually get cached, or did you trim those out for this example?

from miniflare.

mrbbot avatar mrbbot commented on August 29, 2024

Just released version 1.4.0 with this fix. Please let me know if you have any other issues or feedback. 😄

from miniflare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.