Skip to content

Commit

Permalink
fix: Fixing syntax errors and add some test feedback (#892)
Browse files Browse the repository at this point in the history
* fix: Fixing syntax errors and add some test feedback

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>

* fix

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>

---------

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
  • Loading branch information
flc1125 authored May 5, 2023
1 parent 722f172 commit ff0a142
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func main() {
// Send that Event.
if result := c.Send(ctx, event); cloudevents.IsUndelivered(result) {
log.Fatalf("failed to send, %v", result)
} else {
log.Printf("sent: %v", event)
log.Printf("result: %v", result)
}
}
```
Expand Down Expand Up @@ -89,10 +92,11 @@ func main() {
func handler(w http.ResponseWriter, r *http.Request) {
event, err := cloudevents.NewEventFromHTTPRequest(r)
if err != nil {
log.Print("failed to parse CloudEvent from request: %v", err)
log.Printf("failed to parse CloudEvent from request: %v", err)
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
}
w.Write([]byte(*event.String()))
w.Write([]byte(event.String()))
log.Println(event.String())
}
```

Expand Down

0 comments on commit ff0a142

Please sign in to comment.