Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add content-type for rendered pages generated by "http-server" #52

Open
patrickdappollonio opened this issue Jun 28, 2023 · 0 comments
Open
Assignees
Labels

Comments

@patrickdappollonio
Copy link
Owner

From a person using this: after using HTTrack to get a static copy of a website served by http-server, they noticed the content-type meta tag was not present, so httrack added one.

I confirmed this by running it myself:

<!doctype html>

<html lang="en">

<!-- Mirrored from localhost:9000/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 28 Jun 2023 00:12:58 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="generator" content="github.com/patrickdappollonio/http-server development">
  <meta name="theme-color" content="#3f51b5">
  <title>HTTP File Server</title>
  <link rel="stylesheet" href="_/s8jhp0b1/assets/style.css">
  <link rel="stylesheet" href="_/s8jhp0b1/assets/roboto-font.css">
  <link rel="stylesheet" href="_/s8jhp0b1/assets/fontawesome-6.2.0.css">
  <link rel="icon" type="image/svg+xml" href="_/s8jhp0b1/assets/file-server.svg">
  <link rel="stylesheet" href="_/s8jhp0b1/assets/gfm.css">
</head>

We'll need to add the header. While the Go standard library will do content type hinting, it's better if we set this ourselves. Even more so for non-western languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant