Merge pull request #356 from HuKeping/refactor-mainhandler

Refactor a little to reduce indentation
This commit is contained in:
Diogo Mónica 2015-12-11 11:46:26 -08:00
commit ec78a03045
1 changed files with 6 additions and 6 deletions

View File

@ -23,14 +23,14 @@ import (
// MainHandler is the default handler for the server
func MainHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
if r.Method == "GET" {
_, err := w.Write([]byte("{}"))
if err != nil {
return errors.ErrUnknown.WithDetail(err)
}
} else {
// For now it only supports `GET`
if r.Method != "GET" {
return errors.ErrGenericNotFound.WithDetail(nil)
}
if _, err := w.Write([]byte("{}")); err != nil {
return errors.ErrUnknown.WithDetail(err)
}
return nil
}