EUGENIO SOUZA CARVALHO 3 years ago
parent
commit
383933d794
2 changed files with 6 additions and 9 deletions
  1. 5 8
      api/debug.go
  2. 1 1
      translate/got/resources.go

+ 5 - 8
api/debug.go

@@ -7,7 +7,6 @@ import (
 
 	"git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/api/errs"
 	"git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/api/sse"
-	"github.com/kataras/iris"
 	context "github.com/kataras/iris/v12/context"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 )
@@ -110,18 +109,16 @@ func (debug *Debugger) CreateTask() *DebugTaks {
 	return task
 }
 
-func (debug *Debugger) EventStream() func(context.Context) {
-	return func(ctx context.Context) {
-		if err := debug.Hub.UpgradeConnection(
+func (debug *Debugger) EventStream() func(context.Context) (interface{}, *errs.Error) {
+	return func(ctx context.Context) (resp interface{}, err *errs.Error) {
+		if err = debug.Hub.UpgradeConnection(
 			ctx,
 			debug.ChannelID,
 		); err != nil {
-			ctx.JSON(iris.Map{
-				"err": err,
-			})
 			return
 		}
-		ctx.JSON(iris.Map{})
+		resp = true
+		return
 	}
 }
 

+ 1 - 1
translate/got/resources.go

@@ -351,7 +351,7 @@ func GenIndexApi(p *Project) error {
 			args := []G.Code{
 				G.Lit(method.HttpMethod),
 				G.Lit(p.GetPath(method)),
-				G.Lit("Debug.Handler()"),
+				G.Line().Id("Debug.Handler()"),
 			}
 
 			middlewares = []string{}