Refactor a little to reduce indentation

Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
HuKeping 2015-12-11 15:43:01 +08:00
parent 8fd8916b15
commit b78823e5c3
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
}