remove handler/util package in favour of util/router (#1908)

This commit is contained in:
Asim Aslam
2020-08-07 12:47:20 +01:00
committed by GitHub
parent 37cc7fda92
commit 8ee31b94a1
4 changed files with 21 additions and 21 deletions

View File

@@ -6,11 +6,11 @@ import (
goapi "github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/handler"
"github.com/micro/go-micro/v3/api/handler/util"
api "github.com/micro/go-micro/v3/api/proto"
"github.com/micro/go-micro/v3/client"
"github.com/micro/go-micro/v3/errors"
"github.com/micro/go-micro/v3/util/ctx"
"github.com/micro/go-micro/v3/util/router"
)
type apiHandler struct {
@@ -72,7 +72,7 @@ func (a *apiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// create the context from headers
cx := ctx.FromRequest(r)
if err := c.Call(cx, req, rsp, client.WithRouter(util.Router(service.Services))); err != nil {
if err := c.Call(cx, req, rsp, client.WithRouter(router.New(service.Services))); err != nil {
w.Header().Set("Content-Type", "application/json")
ce := errors.Parse(err.Error())
switch ce.Code {