nicolaferraro 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_r335377737
 
 

 ##########
 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:
   Not sure if we need to ask people to manually set "POST" or we should do it 
for them.
   They're sending data to a `knative` endpoint that wraps HTTP after all.
   
   I'm thinking to simple bridging integrations:
   ```
   rest().put("/person/{id}").to("knative:event/person")
   ```
   

----------------------------------------------------------------
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