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

ASF GitHub Bot commented on SCB-1051:
-------------------------------------

heyile commented on a change in pull request #1015: [SCB-1051]when interface 
set produces=text/plain;charset=utf-8. and c…
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1015#discussion_r238695923
 
 

 ##########
 File path: 
integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java
 ##########
 @@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.it.testcase;
+
+import org.apache.servicecomb.it.Consumers;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+
+public class TestAcceptType {
+  interface AcceptTypeIntf {
+  }
+
+  private static Consumers<AcceptTypeIntf> consumersAcceptTypeSpringmvc = new 
Consumers<>("acceptTypeSpringmvcSchema",
+      AcceptTypeIntf.class);
+
+  private static Consumers<AcceptTypeIntf> consumersAcceptTypeJaxrs = new 
Consumers<>("acceptTypeJaxrsSchema",
+      AcceptTypeIntf.class);
+
+
+  @Test
+  public void testTextPlain_rt() {
+    checkTextPlain(consumersAcceptTypeSpringmvc);
+    checkTextPlain(consumersAcceptTypeJaxrs);
+  }
+
+  private void checkTextPlain(Consumers<AcceptTypeIntf> consumers) {
+    String result = textHeader_rt(consumers, MediaType.TEXT_PLAIN_VALUE);
+    Assert.assertEquals("cse", result);
+
+    try {
+      textHeader_rt(consumers, MediaType.APPLICATION_JSON_VALUE);
+      Assert.fail("should throw exception");
+    } catch (InvocationException e) {
+      Assert.assertEquals(406, e.getStatusCode());
+      Assert.assertTrue(e.getMessage().contains("Accept application/json is 
not supported"));
+    } catch (Exception e) {
 
 Review comment:
   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


> when interface set produces=text/plain;charset=utf-8. and consumers set 
> accept = text/plain,will cause error
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: SCB-1051
>                 URL: https://issues.apache.org/jira/browse/SCB-1051
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: 何一乐
>            Assignee: 何一乐
>            Priority: Major
>         Attachments: screenshot-1.png
>
>




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

Reply via email to