diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.go | 20 |
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) } |