aboutsummaryrefslogtreecommitdiff
path: root/core.go
diff options
context:
space:
mode:
authorDoug Black <dblack@twilio.com>2014-03-29 23:16:41 -0700
committerDoug Black <dblack@twilio.com>2014-03-29 23:16:41 -0700
commit70d2d6aee10fdae3ba3c75e0b1feeaf9d9f0e057 (patch)
tree272a00c5db0fb1141553bc64fc5020363bda1e17 /core.go
parentMerge pull request #17 from oleksandr/master (diff)
downloadsleepy-70d2d6aee10fdae3ba3c75e0b1feeaf9d9f0e057.tar.gz
sleepy-70d2d6aee10fdae3ba3c75e0b1feeaf9d9f0e057.tar.bz2
sleepy-70d2d6aee10fdae3ba3c75e0b1feeaf9d9f0e057.zip
use built in http.Header type
Diffstat (limited to 'core.go')
-rw-r--r--core.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/core.go b/core.go
index 7caaca2..f6dd6a7 100644
--- a/core.go
+++ b/core.go
@@ -18,25 +18,25 @@ const (
// GetSupported is the interface that provides the Get
// method a resource must support to receive HTTP GETs.
type GetSupported interface {
- Get(url.Values, map[string][]string) (int, interface{}, map[string][]string)
+ Get(url.Values, http.Header) (int, interface{}, http.Header)
}
// PostSupported is the interface that provides the Post
// method a resource must support to receive HTTP POSTs.
type PostSupported interface {
- Post(url.Values, map[string][]string) (int, interface{}, map[string][]string)
+ Post(url.Values, http.Header) (int, interface{}, http.Header)
}
// PutSupported is the interface that provides the Put
// method a resource must support to receive HTTP PUTs.
type PutSupported interface {
- Put(url.Values, map[string][]string) (int, interface{}, map[string][]string)
+ Put(url.Values, http.Header) (int, interface{}, http.Header)
}
// DeleteSupported is the interface that provides the Delete
// method a resource must support to receive HTTP DELETEs.
type DeleteSupported interface {
- Delete(url.Values, map[string][]string) (int, interface{}, map[string][]string)
+ Delete(url.Values, http.Header) (int, interface{}, http.Header)
}
// An API manages a group of resources by routing requests
@@ -63,7 +63,7 @@ func (api *API) requestHandler(resource interface{}) http.HandlerFunc {
return
}
- var handler func(url.Values, map[string][]string) (int, interface{}, map[string][]string)
+ var handler func(url.Values, http.Header) (int, interface{}, http.Header)
switch request.Method {
case GET:
@@ -89,14 +89,14 @@ func (api *API) requestHandler(resource interface{}) http.HandlerFunc {
return
}
- code, data, headers := handler(request.Form, request.Header)
+ code, data, header := handler(request.Form, request.Header)
content, err := json.Marshal(data)
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
return
}
- for name, values := range headers {
+ for name, values := range header {
for _, value := range values {
rw.Header().Add(name, value)
}
bgstack15