You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2019/10/16 09:49:22 UTC

[GitHub] [camel-k-runtime] lburgazzoli commented on a change in pull request #161: knative: add some checks about supported http methods and mandatory body

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:
users@infra.apache.org


With regards,
Apache Git Services