Skip to content

Commit

Permalink
poc
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Ding <jackding@gmail.com>
  • Loading branch information
jzding committed May 20, 2024
1 parent d3ce1fc commit cbba0cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions v2/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
// 400: badReq
// 204: noContent
func (s *Server) createSubscription(w http.ResponseWriter, r *http.Request) {
log.Printf("DZK in V2 createSubscription")
defer r.Body.Close()
var response *http.Response
bodyBytes, err := io.ReadAll(r.Body)
Expand All @@ -64,6 +65,7 @@ func (s *Server) createSubscription(w http.ResponseWriter, r *http.Request) {
localmetrics.UpdateSubscriptionCount(localmetrics.FAILCREATE, 1)
return
}
log.Printf("DZK sub=%v", sub)
if sub.GetEndpointURI() != "" {
response, err = s.HTTPClient.Post(sub.GetEndpointURI(), cloudevents.ApplicationJSON, nil)
if err != nil {
Expand All @@ -84,6 +86,7 @@ func (s *Server) createSubscription(w http.ResponseWriter, r *http.Request) {
sub.SetID(uuid.New().String())
_ = sub.SetURILocation(fmt.Sprintf("http://localhost:%d%s%s/%s", s.port, s.apiPath, "subscriptions", sub.ID)) //nolint:errcheck

log.Printf("DZK sub2=%v", sub)
newSub, err := s.pubSubAPI.CreateSubscription(sub)
if err != nil {
log.Printf("error creating subscription %v", err)
Expand Down

0 comments on commit cbba0cf

Please sign in to comment.