This repository was archived by the owner on Dec 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
pkg/converter/cloudevents Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,6 @@ func getTask(w http.ResponseWriter, r *http.Request) {
176
176
177
177
w .WriteHeader (http .StatusOK )
178
178
w .Write (task .data )
179
- return
180
179
}
181
180
182
181
func initError (w http.ResponseWriter , r * http.Request ) {
@@ -187,14 +186,13 @@ func initError(w http.ResponseWriter, r *http.Request) {
187
186
defer r .Body .Close ()
188
187
189
188
log .Fatalf ("Runtime initialization error: %s\n " , data )
190
- return
191
189
}
192
190
193
191
func parsePath (query string ) (string , string , error ) {
194
192
path := strings .TrimPrefix (query , awsEndpoint + "/invocation/" )
195
193
request := strings .Split (path , "/" )
196
194
if len (request ) != 2 {
197
- return "" , "" , fmt .Errorf ("Incorrect URL query size" )
195
+ return "" , "" , fmt .Errorf ("incorrect URL query size" )
198
196
}
199
197
return request [0 ], request [1 ], nil
200
198
}
@@ -240,13 +238,11 @@ func responseHandler(w http.ResponseWriter, r *http.Request) {
240
238
statusCode : statusCode ,
241
239
}
242
240
w .WriteHeader (http .StatusAccepted )
243
- return
244
241
}
245
242
246
243
func ping (w http.ResponseWriter , r * http.Request ) {
247
244
w .WriteHeader (http .StatusOK )
248
245
w .Write ([]byte ("pong" ))
249
- return
250
246
}
251
247
252
248
func api () error {
Original file line number Diff line number Diff line change @@ -58,12 +58,16 @@ type Overrides struct {
58
58
func New () (* CloudEvent , error ) {
59
59
var ce CloudEvent
60
60
if err := envconfig .Process ("ce" , & ce ); err != nil {
61
- return nil , fmt .Errorf ("Cannot process CloudEvent env variables: %v" , err )
61
+ return nil , fmt .Errorf ("cannot process CloudEvent env variables: %v" , err )
62
62
}
63
63
return & ce , nil
64
64
}
65
65
66
66
func (ce * CloudEvent ) Response (data []byte ) ([]byte , error ) {
67
+ if len (data ) == 0 {
68
+ return nil , nil
69
+ }
70
+
67
71
if ce .FunctionResponseMode == "event" {
68
72
return ce .fillInContext (data )
69
73
}
You can’t perform that action at this time.
0 commit comments