You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/12/14 03:12:41 UTC

[GitHub] [shenyu] key9527 opened a new pull request, #4266: ShenyuResult MediaType.APPLICATION_JSON_UTF8

key9527 opened a new pull request, #4266:
URL: https://github.com/apache/shenyu/pull/4266

   建议这里还是用MediaType.APPLICATION_JSON_UTF8,实测在对接某些老旧系统时,这里不指定charset,对方接收会乱码。
   


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

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] yu199195 commented on a diff in pull request #4266: ShenyuResult MediaType.APPLICATION_JSON_UTF8

Posted by GitBox <gi...@apache.org>.
yu199195 commented on code in PR #4266:
URL: https://github.com/apache/shenyu/pull/4266#discussion_r1051840237


##########
shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/result/ShenyuResult.java:
##########
@@ -70,7 +70,7 @@ default MediaType contentType(ServerWebExchange exchange, Object formatted) {
         if (Objects.nonNull(clientResponse) && clientResponse.headers().contentType().isPresent()) {
             return clientResponse.headers().contentType().get();
         }
-        return MediaType.APPLICATION_JSON;
+        return MediaType.APPLICATION_JSON_UTF8;

Review Comment:
   Are they different, can they be dynamically configured or returned based on front-end incoming?



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

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] codecov-commenter commented on pull request #4266: ShenyuResult MediaType.APPLICATION_JSON_UTF8

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #4266:
URL: https://github.com/apache/shenyu/pull/4266#issuecomment-1350377990

   # [Codecov](https://codecov.io/gh/apache/shenyu/pull/4266?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#4266](https://codecov.io/gh/apache/shenyu/pull/4266?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a5908e0) into [master](https://codecov.io/gh/apache/shenyu/commit/183493156f8d270baa6794dcc6efe904a1b92265?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1834931) will **decrease** coverage by `0.10%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4266      +/-   ##
   ============================================
   - Coverage     69.50%   69.39%   -0.11%     
   + Complexity     7387     7355      -32     
   ============================================
     Files           995      995              
     Lines         27991    27991              
     Branches       2477     2477              
   ============================================
   - Hits          19455    19425      -30     
   - Misses         7057     7089      +32     
   + Partials       1479     1477       -2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shenyu/pull/4266?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../apache/shenyu/admin/model/dto/BatchCommonDTO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0JhdGNoQ29tbW9uRFRPLmphdmE=) | `50.00% <0.00%> (-7.15%)` | :arrow_down: |
   | [...apache/shenyu/admin/model/dto/AuthPathWarpDTO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoV2FycERUTy5qYXZh) | `57.14% <0.00%> (-7.15%)` | :arrow_down: |
   | [...org/apache/shenyu/admin/model/dto/AuthPathDTO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoRFRPLmphdmE=) | `58.82% <0.00%> (-5.89%)` | :arrow_down: |
   | [...a/org/apache/shenyu/admin/model/entity/BaseDO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZW50aXR5L0Jhc2VETy5qYXZh) | `52.17% <0.00%> (-4.35%)` | :arrow_down: |
   | [...che/shenyu/admin/model/vo/DashboardUserEditVO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvdm8vRGFzaGJvYXJkVXNlckVkaXRWTy5qYXZh) | `60.86% <0.00%> (-4.35%)` | :arrow_down: |
   | [...henyu/plugin/grpc/resolver/ShenyuNameResolver.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9yZXNvbHZlci9TaGVueXVOYW1lUmVzb2x2ZXIuamF2YQ==) | `59.57% <0.00%> (-4.26%)` | :arrow_down: |
   | [...ache/shenyu/admin/model/dto/DataPermissionDTO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0RhdGFQZXJtaXNzaW9uRFRPLmphdmE=) | `59.25% <0.00%> (-3.71%)` | :arrow_down: |
   | [...rg/apache/shenyu/admin/model/page/CommonPager.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvcGFnZS9Db21tb25QYWdlci5qYXZh) | `44.82% <0.00%> (-3.45%)` | :arrow_down: |
   | [...he/shenyu/admin/model/vo/DataPermissionPageVO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvdm8vRGF0YVBlcm1pc3Npb25QYWdlVk8uamF2YQ==) | `50.00% <0.00%> (-3.34%)` | :arrow_down: |
   | [...a/org/apache/shenyu/admin/model/dto/PluginDTO.java](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL1BsdWdpbkRUTy5qYXZh) | `60.60% <0.00%> (-3.04%)` | :arrow_down: |
   | ... and [25 more](https://codecov.io/gh/apache/shenyu/pull/4266/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


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

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] key9527 commented on a diff in pull request #4266: ShenyuResult MediaType.APPLICATION_JSON_UTF8

Posted by GitBox <gi...@apache.org>.
key9527 commented on code in PR #4266:
URL: https://github.com/apache/shenyu/pull/4266#discussion_r1057479250


##########
shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/result/ShenyuResult.java:
##########
@@ -70,7 +70,7 @@ default MediaType contentType(ServerWebExchange exchange, Object formatted) {
         if (Objects.nonNull(clientResponse) && clientResponse.headers().contentType().isPresent()) {
             return clientResponse.headers().contentType().get();
         }
-        return MediaType.APPLICATION_JSON;
+        return MediaType.APPLICATION_JSON_UTF8;

Review Comment:
   this code is used for WebFluxResultUtils.result(exchange, error);   for example:
   `
           if (CollectionUtils.isEmpty(upstreamList)) {
               LOG.error("divide upstream configuration error: {}", selector);
               Object error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.CANNOT_FIND_HEALTHY_UPSTREAM_URL);
               return WebFluxResultUtils.result(exchange, error);
           }
   `
    If I customize the error message in chinese,when this msg returned ,  The receiver cannot recognize this charset。because this is shenyu returned, not back-end 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.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] yu199195 closed pull request #4266: ShenyuResult MediaType.APPLICATION_JSON_UTF8

Posted by "yu199195 (via GitHub)" <gi...@apache.org>.
yu199195 closed pull request #4266: ShenyuResult  MediaType.APPLICATION_JSON_UTF8
URL: https://github.com/apache/shenyu/pull/4266


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

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org