denoland / std

The Deno Standard Library
https://jsr.io/@std
MIT License
3.14k stars 617 forks source link

`@std/http`: Failing to serve favicon #6120

Open ArkhamCookie opened 1 week ago

ArkhamCookie commented 1 week ago

Describe the bug

Steps to Reproduce

deno.json:

{
  "imports": { "@std/http": "jsr:@std/http@^1.0.8" }
}

server.js:

import { serveDir } from "@std/http";

Deno.serve((request) => {
  return serveDir(request, {
    fsRoot: "public",
  });
});

public/index.html:

<!DOCTYPE html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, inital-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>

My file structure has the favicon in the public directory.

Run deno run --allow-net --allow-read server.js.

In the console it is saying that GET http://0.0.0.0:8000/favicon.ico failed, and the favicon doesn't show up.

Expected behavior

The favicon icon in head should be served and show up.

Environment

kt3k commented 3 days ago

In the console it is saying that GET http://0.0.0.0:8000/favicon.ico failed

What's the exact error message? What does network panel say about http://0.0.0.0:8000/favicon.ico?