summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--handlers.go5
-rw-r--r--main.go2
-rw-r--r--types.go2
3 files changed, 5 insertions, 4 deletions
diff --git a/handlers.go b/handlers.go
index ce33716..d57feee 100644
--- a/handlers.go
+++ b/handlers.go
@@ -8,8 +8,6 @@ import (
 	"time"
 )
 
-const textutf8 = "text/plain; charset=utf8"
-
 func validRequest(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 		m := confObj.validPath.FindStringSubmatch(r.URL.Path)
@@ -30,7 +28,8 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
 	etag := fmt.Sprintf("%x", sha256.Sum256(timerfc3339))
 	w.Header().Set("ETag", etag)
 	w.Header().Set("Content-Type", textutf8)
-	timerfc3339 = append(timerfc3339, byte('\n'))
+	pathdata := []byte("\n\n" + r.URL.Path)
+	timerfc3339 = append(timerfc3339, pathdata...)
 	n, err := w.Write(timerfc3339)
 	if err != nil || n == 0 {
 		log.Printf("Error writing to HTTP stream: %v\n", err)
diff --git a/main.go b/main.go
index 7d13c32..83344d0 100644
--- a/main.go
+++ b/main.go
@@ -8,7 +8,7 @@ import (
 func main() {
 	log.Printf("getwtxt v0.1\n")
 
-	http.HandleFunc("/api", apiHandler)
+	http.HandleFunc("/api/", apiHandler)
 
 	log.Fatalln(http.ListenAndServe(":8080", nil))
 }
diff --git a/types.go b/types.go
index a8f027a..fa9b8aa 100644
--- a/types.go
+++ b/types.go
@@ -2,6 +2,8 @@ package main
 
 import "regexp"
 
+const textutf8 = "text/plain; charset=utf8"
+
 type configuration struct {
 	port         string
 	validPath    *regexp.Regexp