aboutsummaryrefslogtreecommitdiff
path: root/tests/test.go
diff options
context:
space:
mode:
authorDoug Black <dougblack@gatech.edu>2014-01-25 14:19:04 -0800
committerDoug Black <dougblack@gatech.edu>2014-01-25 14:19:04 -0800
commite2167e0b2953d2ce4ca5f30565d62efa44814caa (patch)
tree8cc7ac270212a3bc1bc1808cf1a11d768c6389eb /tests/test.go
parentcollapse into one type declaration (diff)
downloadsleepy-e2167e0b2953d2ce4ca5f30565d62efa44814caa.tar.gz
sleepy-e2167e0b2953d2ce4ca5f30565d62efa44814caa.tar.bz2
sleepy-e2167e0b2953d2ce4ca5f30565d62efa44814caa.zip
better practices
Diffstat (limited to 'tests/test.go')
-rw-r--r--tests/test.go20
1 files changed, 4 insertions, 16 deletions
diff --git a/tests/test.go b/tests/test.go
index 055067c..53c7f9e 100644
--- a/tests/test.go
+++ b/tests/test.go
@@ -1,9 +1,8 @@
package main
import (
- "fmt"
"sleepy"
- "net/http"
+ "net/url"
)
type Bar struct {
@@ -12,8 +11,8 @@ type Bar struct {
sleepy.DeleteNotSupported
}
-func (b Bar) Get(map[string][]string) string {
- return "Hello"
+func (b Bar) Get(values ...url.Values) (int, interface{}) {
+ return 200, map[string]string{"hello": "goodbye"}
}
type Baz struct {
@@ -22,22 +21,11 @@ type Baz struct {
sleepy.DeleteNotSupported
}
-func (b Baz) Get(map[string][]string) string {
- return "Goodbye"
-}
-
func main() {
bar := new(Bar)
- baz := new(Baz)
var api = new(sleepy.Api)
api.AddResource(bar, "/bar")
- api.AddResource(baz, "/baz")
-
- request1, _ := http.NewRequest("GET", "https://dougblack.io/bar", nil)
- request2, _ := http.NewRequest("GET", "https://dougblack.io/baz", nil)
- fmt.Println(api.HandleRequest(request1))
- fmt.Println(api.HandleRequest(request2))
-
+ api.Start(3000)
}
bgstack15