Skip to content

When dynamically loading a custom plugin, the request body cannot be obtained #3349

@fddOs

Description

@fddOs

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Load the plug-in package in the form of jar, in the protected abstract Mono doExecute(ServerWebExchange exchange, ShenyuPluginChain chain, SelectorData selector, RuleData rule) {} method in the plug-in, the request obtained by the serverRequest.bodyToMono(String.class) method body is empty

Expected Behavior

The request body can be obtained correctly through the serverRequest.bodyToMono(String.class) method

Steps To Reproduce

1.version:2.4.2
2.Customize the plug-in, package it into a jar, put it in the ext-lib folder
3.Processing in plugins:
protected Mono doExecute(final ServerWebExchange exchange, final ShenyuPluginChain chain, final SelectorData selector, final RuleData rule) {
ServerRequest serverRequest = ServerRequest.create(exchange, MESSAGE_READERS);
Mono mono = serverRequest.bodyToMono(String.class)
.switchIfEmpty(Mono.defer(() -> Mono.just("")))
.flatMap(originalBody -> //originalBody is ”“);
//todo
}

Environment

ShenYu version(s):2.4.2

Debug logs

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions