From 599d52cf8d90200603c46d5e7d023f5bd9a9f69d Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 23 Jul 2020 22:02:53 -0600 Subject: [PATCH] Change to trace and make a deploy for tickle --- .gitignore | 1 + deploy.sh | 12 ++++++++++++ view/who.go | 6 +++--- view/who_test.go | 8 ++++---- 4 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 deploy.sh diff --git a/.gitignore b/.gitignore index 78fd378..9c4e808 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/*.sw* +dndex diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..de39cba --- /dev/null +++ b/deploy.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +function main() { + cd "$(dirname "$BASH_SOURCE")" + set -e + GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -o $(basename "$PWD") -a -installsuffix cgo + scp ./dndex zach@192.168.1.123:./dndex/dndex.new +} + +if [ "$0" == "$BASH_SOURCE" ]; then + main "$@" +fi diff --git a/view/who.go b/view/who.go index 44d068e..f45b1e2 100644 --- a/view/who.go +++ b/view/who.go @@ -34,8 +34,8 @@ func who(g storage.Graph, w http.ResponseWriter, r *http.Request) error { return whoDelete(namespace, g, w, r) case http.MethodPatch: return whoPatch(namespace, g, w, r) - case http.MethodHead: - return whoHead(namespace, g, w, r) + case http.MethodTrace: + return whoTrace(namespace, g, w, r) default: http.NotFound(w, r) return nil @@ -183,7 +183,7 @@ func whoPatch(namespace string, g storage.Graph, w http.ResponseWriter, r *http. return whoGet(namespace, g, w, r) } -func whoHead(namespace string, g storage.Graph, w http.ResponseWriter, r *http.Request) error { +func whoTrace(namespace string, g storage.Graph, w http.ResponseWriter, r *http.Request) error { ones, err := g.List(r.Context(), namespace) if err != nil { return err diff --git a/view/who_test.go b/view/who_test.go index 00d456d..7e4b8fc 100644 --- a/view/who_test.go +++ b/view/who_test.go @@ -227,8 +227,8 @@ func TestWho(t *testing.T) { t.Logf("%s", w.Body.Bytes()) }) - t.Run("head fake", func(t *testing.T) { - r := httptest.NewRequest(http.MethodHead, "/who/notcol", nil) + t.Run("trace fake", func(t *testing.T) { + r := httptest.NewRequest(http.MethodTrace, "/who/notcol", nil) w := httptest.NewRecorder() handler.ServeHTTP(w, r) if w.Code != http.StatusOK { @@ -236,8 +236,8 @@ func TestWho(t *testing.T) { } }) - t.Run("head real", func(t *testing.T) { - r := httptest.NewRequest(http.MethodHead, "/who/col", nil) + t.Run("trace real", func(t *testing.T) { + r := httptest.NewRequest(http.MethodTrace, "/who/col", nil) w := httptest.NewRecorder() handler.ServeHTTP(w, r) if w.Code != http.StatusOK {