lburgazzoli commented on a change in pull request #161: knative: add some 
checks about supported http methods and mandatory body
URL: https://github.com/apache/camel-k-runtime/pull/161#discussion_r335379627
 
 

 ##########
 File path: 
camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumerDispatcher.java
 ##########
 @@ -167,6 +168,15 @@ protected void doStop() throws Exception {
 
         @Override
         public void handle(HttpServerRequest request) {
+            if (request.method() != HttpMethod.POST) {
+                HttpServerResponse response = request.response();
+                response.setStatusCode(405);
+                response.putHeader(Exchange.CONTENT_TYPE, "text/plain");
+                response.end("Unsupported method: " + request.method());
 
 Review comment:
   the component does it by default, in your case you want to "put" an event to 
the broker and the underlying transport implementation will hit a POST to the 
target knative service.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to