Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(go-http): http quickstart is broken #885

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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