Skip to content
Permalink
Browse files

removed []byte return on AfterAPIResponse, not needed)

  • Loading branch information...
Ollie Phillips
Ollie Phillips committed Apr 4, 2019
1 parent 7063494 commit 878d593ef5da1435c83bf7bb229f8619c1cab9ff
Showing with 6 additions and 6 deletions.
  1. +3 −3 system/api/handlers.go
  2. +3 −3 system/item/item.go
@@ -120,7 +120,7 @@ func contentsHandler(res http.ResponseWriter, req *http.Request) {
sendData(res, req, j)

// hook after response
_, err = hook.AfterAPIResponse(res, req, j)
err = hook.AfterAPIResponse(res, req, j)
if err != nil {
log.Println("[Response] error calling AfterAPIResponse:", err)
return
@@ -200,7 +200,7 @@ func contentHandler(res http.ResponseWriter, req *http.Request) {
sendData(res, req, j)

// hook after response
_, err = hook.AfterAPIResponse(res, req, j)
err = hook.AfterAPIResponse(res, req, j)
if err != nil {
log.Println("[Response] error calling AfterAPIResponse:", err)
return
@@ -274,7 +274,7 @@ func contentHandlerBySlug(res http.ResponseWriter, req *http.Request) {
sendData(res, req, j)

// hook after response
_, err = hook.AfterAPIResponse(res, req, j)
err = hook.AfterAPIResponse(res, req, j)
if err != nil {
log.Println("[Response] error calling AfterAPIResponse:", err)
return
@@ -66,7 +66,7 @@ type Sortable interface {
// Hookable with no-ops so our user can override only whichever ones necessary.
type Hookable interface {
BeforeAPIResponse(http.ResponseWriter, *http.Request, []byte) ([]byte, error)
AfterAPIResponse(http.ResponseWriter, *http.Request, []byte) ([]byte, error)
AfterAPIResponse(http.ResponseWriter, *http.Request, []byte) error

BeforeAPICreate(http.ResponseWriter, *http.Request) error
AfterAPICreate(http.ResponseWriter, *http.Request) error
@@ -186,8 +186,8 @@ func (i Item) BeforeAPIResponse(res http.ResponseWriter, req *http.Request, data
}

// AfterAPIResponse is a no-op to ensure structs which embed Item implement Hookable
func (i Item) AfterAPIResponse(res http.ResponseWriter, req *http.Request, data []byte) ([]byte, error) {
return data, nil
func (i Item) AfterAPIResponse(res http.ResponseWriter, req *http.Request, data []byte) error {
return nil
}

// BeforeAPICreate is a no-op to ensure structs which embed Item implement Hookable

0 comments on commit 878d593

Please sign in to comment.
You can’t perform that action at this time.