[ 
https://issues.apache.org/jira/browse/CAMEL-11162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16497125#comment-16497125
 ] 

ASF GitHub Bot commented on CAMEL-11162:
----------------------------------------

aldettinger closed pull request #2355: CAMEL-11162: Corrected doc and 
alleviated tests
URL: https://github.com/apache/camel/pull/2355
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/camel-core/src/main/docs/rest-dsl.adoc 
b/camel-core/src/main/docs/rest-dsl.adoc
index 7402ba94a59..6044de1edbc 100644
--- a/camel-core/src/main/docs/rest-dsl.adoc
+++ b/camel-core/src/main/docs/rest-dsl.adoc
@@ -652,7 +652,7 @@ functionality is only applicable for query parameters.
 From *Camel 2.22* onwards its possible to enable validation of the incoming 
client request.
 The validation checks for the following:
 
-- Content-Type header matches what the Rest DSL consumes. (Returns HTTP Status 
416)
+- Content-Type header matches what the Rest DSL consumes. (Returns HTTP Status 
415)
 - Accept header matches what the Rest DSL produces. (Returns HTTP Status 406)
 - Missing required data (query parameters, HTTP headers, body). (Returns HTTP 
Status 400)
 
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
index d48472ef7e0..4b9927883c8 100644
--- 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyAcceptTest.java
@@ -80,7 +80,6 @@ public void configure() throws Exception {
                 rest("/users/")
                     
.post("{id}/update").consumes("application/json").produces("application/json")
                         .route()
-                        .to("mock:input")
                         .setBody(constant("{ \"status\": \"ok\" }"));
             }
         };
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
index b4d50bc01f2..4076b0cd905 100644
--- 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyContentTypeTest.java
@@ -78,7 +78,6 @@ public void configure() throws Exception {
                 rest("/users/")
                     
.post("{id}/update").consumes("application/json").produces("application/json")
                         .route()
-                        .to("mock:input")
                         .setBody(constant("{ \"status\": \"ok\" }"));
             }
         };
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
index 3ef0ebb0541..6c338e96cec 100644
--- 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredBodyTest.java
@@ -70,7 +70,6 @@ public void configure() throws Exception {
                     
.post("{id}/update").consumes("application/json").produces("application/json")
                     
.param().name("body").required(true).type(RestParamType.body).endParam()
                         .route()
-                        .to("mock:input")
                         .setBody(constant("{ \"status\": \"ok\" }"));
             }
         };
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
index 728826eeace..61222b79743 100644
--- 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredHttpHeaderTest.java
@@ -72,7 +72,6 @@ public void configure() throws Exception {
                     
.post("{id}/update").consumes("application/json").produces("application/json")
                     
.param().name("country").required(true).type(RestParamType.header).endParam()
                         .route()
-                        .to("mock:input")
                         .setBody(constant("{ \"status\": \"ok\" }"));
             }
         };
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
index 092ab9f6d2c..2627f00e6f7 100644
--- 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyRequiredQueryParameterTest.java
@@ -71,7 +71,6 @@ public void configure() throws Exception {
                     
.post("{id}/update").consumes("application/json").produces("application/json")
                     
.param().name("country").required(true).type(RestParamType.query).endParam()
                         .route()
-                        .to("mock:input")
                         .setBody(constant("{ \"status\": \"ok\" }"));
             }
         };


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> camel-rest - Should we add content-type check for server side
> -------------------------------------------------------------
>
>                 Key: CAMEL-11162
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11162
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 2.22.0
>
>
> For example setting up a rest-dsl which consumes application/json and then a 
> client calls it with text/plain or application/xml, should we then automatic 
> let rest consumer detect this and return a HTTP status 415 (unsuported media 
> type)
> Not all the HTTP server components does this today, eg jetty etc. But when 
> using restlet which is more natual REST it would do so.
> We could then add an option to turn this on|off. 
> The check is only if the media-type is within the list that may have been 
> specified on consumes in the rest-dsl.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to