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/07/01 03:41:33 UTC

[GitHub] [incubator-shenyu] LiuTianyou commented on a diff in pull request #3599: [ISSUE #3464] add new feature for mock plugin

LiuTianyou commented on code in PR #3599:
URL: https://github.com/apache/incubator-shenyu/pull/3599#discussion_r911590729


##########
shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/utils/WebFluxResultUtils.java:
##########
@@ -72,21 +70,7 @@ public static Mono<Void> result(final ServerWebExchange exchange, final Object r
             .bufferFactory().wrap(bytes))
             .doOnNext(data -> exchange.getResponse().getHeaders().setContentLength(data.readableByteCount())));
     }
-
-    /**
-     * Response result and support specify the http status code .
-     *
-     * @param exchange   the exchange

Review Comment:
   I encapsulated resultCustomStatusCode by calling the WebFluxResultUtils#result method before. However, the result method will set the MIME type. Although the data of the Mock is a string, it should be set to application/json, so I moved this part to the doExecute of the MockPlugin. The operation of response will be more flexible



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