summaryrefslogtreecommitdiff
path: root/srv/src/api/mailinglist.go
diff options
context:
space:
mode:
Diffstat (limited to 'srv/src/api/mailinglist.go')
-rw-r--r--srv/src/api/mailinglist.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/srv/src/api/mailinglist.go b/srv/src/api/mailinglist.go
index d89fe2a..c12e75d 100644
--- a/srv/src/api/mailinglist.go
+++ b/srv/src/api/mailinglist.go
@@ -5,7 +5,7 @@ import (
"net/http"
"strings"
- "github.com/mediocregopher/blog.mediocregopher.com/srv/api/apiutils"
+ "github.com/mediocregopher/blog.mediocregopher.com/srv/api/apiutil"
"github.com/mediocregopher/blog.mediocregopher.com/srv/mailinglist"
)
@@ -16,7 +16,7 @@ func (a *api) mailingListSubscribeHandler() http.Handler {
parts[0] == "" ||
parts[1] == "" ||
len(email) >= 512 {
- apiutils.BadRequest(rw, r, errors.New("invalid email"))
+ apiutil.BadRequest(rw, r, errors.New("invalid email"))
return
}
@@ -26,11 +26,11 @@ func (a *api) mailingListSubscribeHandler() http.Handler {
// just eat the error, make it look to the user like the
// verification email was sent.
} else if err != nil {
- apiutils.InternalServerError(rw, r, err)
+ apiutil.InternalServerError(rw, r, err)
return
}
- apiutils.JSONResult(rw, r, struct{}{})
+ apiutil.JSONResult(rw, r, struct{}{})
})
}
@@ -40,25 +40,25 @@ func (a *api) mailingListFinalizeHandler() http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
subToken := r.PostFormValue("subToken")
if l := len(subToken); l == 0 || l > 128 {
- apiutils.BadRequest(rw, r, errInvalidSubToken)
+ apiutil.BadRequest(rw, r, errInvalidSubToken)
return
}
err := a.params.MailingList.FinalizeSubscription(subToken)
if errors.Is(err, mailinglist.ErrNotFound) {
- apiutils.BadRequest(rw, r, errInvalidSubToken)
+ apiutil.BadRequest(rw, r, errInvalidSubToken)
return
} else if errors.Is(err, mailinglist.ErrAlreadyVerified) {
// no problem
} else if err != nil {
- apiutils.InternalServerError(rw, r, err)
+ apiutil.InternalServerError(rw, r, err)
return
}
- apiutils.JSONResult(rw, r, struct{}{})
+ apiutil.JSONResult(rw, r, struct{}{})
})
}
@@ -68,21 +68,21 @@ func (a *api) mailingListUnsubscribeHandler() http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
unsubToken := r.PostFormValue("unsubToken")
if l := len(unsubToken); l == 0 || l > 128 {
- apiutils.BadRequest(rw, r, errInvalidUnsubToken)
+ apiutil.BadRequest(rw, r, errInvalidUnsubToken)
return
}
err := a.params.MailingList.Unsubscribe(unsubToken)
if errors.Is(err, mailinglist.ErrNotFound) {
- apiutils.BadRequest(rw, r, errInvalidUnsubToken)
+ apiutil.BadRequest(rw, r, errInvalidUnsubToken)
return
} else if err != nil {
- apiutils.InternalServerError(rw, r, err)
+ apiutil.InternalServerError(rw, r, err)
return
}
- apiutils.JSONResult(rw, r, struct{}{})
+ apiutil.JSONResult(rw, r, struct{}{})
})
}