-
Notifications
You must be signed in to change notification settings - Fork 0
/
http-root.go
34 lines (26 loc) · 706 Bytes
/
http-root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2020 Blues Inc. All rights reserved.
// Use of this source code is governed by licenses granted by the
// copyright holder including that found in the LICENSE file.
package main
import (
"net/http"
"net/url"
"path"
)
// Root handler
func inboundWebRootHandler(httpRsp http.ResponseWriter, httpReq *http.Request) {
// Process the request URI, looking for things that will indicate "dev"
method := httpReq.Method
if method == "" {
method = "GET"
}
// Get the target
parsedURL, _ := url.Parse(httpReq.RequestURI)
target := path.Base(parsedURL.Path)
// Exit if just the favicon
if target == "favicon.ico" {
return
}
// Done
httpRsp.Write([]byte("I'm watching you."))
}