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) {
176176
177177 w .WriteHeader (http .StatusOK )
178178 w .Write (task .data )
179- return
180179}
181180
182181func initError (w http.ResponseWriter , r * http.Request ) {
@@ -187,14 +186,13 @@ func initError(w http.ResponseWriter, r *http.Request) {
187186 defer r .Body .Close ()
188187
189188 log .Fatalf ("Runtime initialization error: %s\n " , data )
190- return
191189}
192190
193191func parsePath (query string ) (string , string , error ) {
194192 path := strings .TrimPrefix (query , awsEndpoint + "/invocation/" )
195193 request := strings .Split (path , "/" )
196194 if len (request ) != 2 {
197- return "" , "" , fmt .Errorf ("Incorrect URL query size" )
195+ return "" , "" , fmt .Errorf ("incorrect URL query size" )
198196 }
199197 return request [0 ], request [1 ], nil
200198}
@@ -240,13 +238,11 @@ func responseHandler(w http.ResponseWriter, r *http.Request) {
240238 statusCode : statusCode ,
241239 }
242240 w .WriteHeader (http .StatusAccepted )
243- return
244241}
245242
246243func ping (w http.ResponseWriter , r * http.Request ) {
247244 w .WriteHeader (http .StatusOK )
248245 w .Write ([]byte ("pong" ))
249- return
250246}
251247
252248func api () error {
Original file line number Diff line number Diff line change @@ -58,12 +58,16 @@ type Overrides struct {
5858func New () (* CloudEvent , error ) {
5959 var ce CloudEvent
6060 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 )
6262 }
6363 return & ce , nil
6464}
6565
6666func (ce * CloudEvent ) Response (data []byte ) ([]byte , error ) {
67+ if len (data ) == 0 {
68+ return nil , nil
69+ }
70+
6771 if ce .FunctionResponseMode == "event" {
6872 return ce .fillInContext (data )
6973 }
You can’t perform that action at this time.
0 commit comments