Fix non-ASCII quotes in HTML

Fixes #304

Changes the non-ASCII curly quotes in the HTML to use the regular ASCII double quotes. Also adds a test to check for the existence of non-ASCII characters in that same HTML.
This commit is contained in:
Ben Tranter
2016-09-12 11:03:19 -04:00
parent e41d360e77
commit ad6206078f
2 changed files with 13 additions and 1 deletions

View File

@@ -442,7 +442,7 @@ func (s *Server) HandleRoot(w http.ResponseWriter, r *http.Request) {
<head>
<link rel="shortcut icon" href="http://nats.io/img/favicon.ico">
<style type="text/css">
body { font-family: Century Gothic, CenturyGothic, AppleGothic, sans-serif; font-size: 22; }
body { font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif; font-size: 22; }
a { margin-left: 32px; }
</style>
</head>

View File

@@ -11,6 +11,7 @@ import (
"strings"
"testing"
"time"
"unicode"
"github.com/nats-io/nats"
"sync"
@@ -1167,6 +1168,17 @@ func TestHandleRoot(t *testing.T) {
if resp.StatusCode != 200 {
t.Fatalf("Expected a 200 response, got %d\n", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.Fatalf("Expected no error reading body: Got %v\n", err)
}
for _, b := range body {
if b > unicode.MaxASCII {
t.Fatalf("Expected body to contain only ASCII characters, but got %v\n", b)
}
}
ct := resp.Header.Get("Content-Type")
if !strings.Contains(ct, "text/html") {
t.Fatalf("Expected text/html response, got %s\n", ct)