Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkLeong committed Nov 21, 2022
1 parent 124f5dd commit d7972e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions api/message_bus/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,6 @@ components:
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Property"

RegisterActionType:
Expand Down
12 changes: 11 additions & 1 deletion route/api_route_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package route

import (
"fmt"
"io/ioutil"
"net"
"net/http"
"time"
Expand Down Expand Up @@ -87,9 +88,18 @@ func (r *APIRoute) PublishEvent(ctx echo.Context, sourceID codegen.SourceID, nam
}

var properties map[string]string
if err := ctx.Bind(&properties); err != nil {
body, err := ioutil.ReadAll(ctx.Request().Body)

if err != nil {

message := err.Error()
return ctx.JSON(http.StatusBadRequest, codegen.ResponseBadRequest{Message: &message})
} else {
err = json.Unmarshal(body, &properties)
if err != nil {
message := err.Error()
return ctx.JSON(http.StatusBadRequest, codegen.ResponseBadRequest{Message: &message})
}
}

event := codegen.Event{
Expand Down

0 comments on commit d7972e6

Please sign in to comment.