Skip to content

Commit

Permalink
Merge pull request #885 from guergabo/guergabo/go-http
Browse files Browse the repository at this point in the history
fix(go-http): http quickstart is broken
  • Loading branch information
paulyuk authored Jun 15, 2023
2 parents 7f3a91e + 9e7d6e1 commit 879f8a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pub_sub/go/http/checkout/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func main() {
log.Fatal(err.Error())
}

req.Header.Set("Content-Type", "application/json")

// Publish an event using Dapr pub/sub
res, err := client.Do(req)
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions pub_sub/go/http/order-processor/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type JSONObj struct {
}

type Result struct {
Data string `json:"data"`
Data map[string]int `json:"data"`
}

func getOrder(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -49,7 +49,10 @@ func postOrder(w http.ResponseWriter, r *http.Request) {
if err != nil {
log.Fatal(err.Error())
}
fmt.Println("Subscriber received:", string(result.Data))
for k, v := range result.Data {
d := fmt.Sprintf(`Subscriber received: {"%s":%d}`, k, v)
fmt.Println(d)
}
obj, err := json.Marshal(data)
if err != nil {
log.Fatal(err.Error())
Expand Down

0 comments on commit 879f8a6

Please sign in to comment.