Git Product home page Git Product logo

Comments (4)

mrbbot avatar mrbbot commented on August 19, 2024

Hey! 👋 Are you saying you were able to return an instance of the HTMLResponse class from that library instead of a Response? If so, that should be fine, as the HTMLResponse class extends from Response, so should inherit its behaviour.

from miniflare.

janat08 avatar janat08 commented on August 19, 2024

No I just returned template literal with that library which is why I referenced it, and an error should’ve been thrown because it would in production.

from miniflare.

mrbbot avatar mrbbot commented on August 19, 2024

Ok, I agree there should definitely be an error thrown if the returned response is not a Response. I'm interested that you say "no errors were thrown" though. When I try run this code I get the following error:

import { html } from "@worker-tools/html";

addEventListener("fetch", e => {
  e.respondWith(html`<h1>test</h1>`);
});
[mf:err] GET /: TypeError: Cannot read properties of undefined (reading 'delete')
    at Miniflare._Miniflare_httpRequestListener (.../miniflare/src/index.ts:420:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Is this what you're doing/seeing?

from miniflare.

janat08 avatar janat08 commented on August 19, 2024

I was using worktop so maybe that automatically wraps things in a response, so I simply wasn't able to use the html because there wasn't a content type or something. I suppose that even in miniflare basically trying to send a string along won't a work if it's not instantiated.

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.