Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StaplerRequest http body is null #246

Open
jrichardsz opened this issue Jun 30, 2021 · 0 comments
Open

StaplerRequest http body is null #246

jrichardsz opened this issue Jun 30, 2021 · 0 comments

Comments

@jrichardsz
Copy link

I developed a plugin which receives http body as notifications from gitlab and bitbucket. This plugin is working as expected in previous versions (2020 approximately). Today I installed it on latest version 2.293 and when I send a classic http post with json body using my postman I detected that is empty or null.

Url parameters and headers are detected, but body is null.

Jenkins plugin template use stapler instead native httpservletrequest.

This is my receiver:
https://github.com/software-architect-tools/easy-webhook-plugin/blob/058fadcc95519d2194340628a026203b930bad05/src/main/java/org/jrichardsz/jenkins/plugins/easywebhook/WebHookReceiver.java#L65

And this is how I extract the body:
https://github.com/software-architect-tools/easy-webhook-plugin/blob/058fadcc95519d2194340628a026203b930bad05/src/main/java/org/jrichardsz/jenkins/plugins/easywebhook/WebhookExecutor.java#L28

Thinking that something changed, I updated my plugin with latest jenkins libraries using bitbucket plugin pom.xml as example. This plugin uses the same procedure to get the body. But the error is the same.

Also I tried with:

  • request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
  • IOUtils.toString(request.getReader());

I will continue my tests.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant