jenkinsci / generic-webhook-trigger-plugin

Can receive any HTTP request, extract any values from JSON or XML and trigger a job with those values available as variables. Works with GitHub, GitLab, Bitbucket, Jira and many more.
https://plugins.jenkins.io/generic-webhook-trigger
404 stars 159 forks source link

XMLHtmlRequest does not supply body to Job #229

Closed StefanIGit closed 2 years ago

StefanIGit commented 2 years ago

Hi, I have a webpage with a form which should trigger a Jenkins job when Submit is clicked. It should supply the form data to the job and the job should use it.

I managed, by javascript, to send a xhr (XmlHttpRequest) with the form data as json in body. It looks kind of correct in the Jenkins log except I have 2 request, the preflight (OPTIONS) and the POST.

Triggering Scalers/Change_Scale_Settings
Jan 14, 2022 5:45:19 PM FINE org.jenkinsci.plugins.gwt.GenericWebHookRequestReceiver
 with:

Jan 14, 2022 5:45:19 PM FINE org.jenkinsci.plugins.gwt.GenericWebHookRequestReceiver
Triggering Scalers/Change_Scale_Settings
Jan 14, 2022 5:45:19 PM FINE org.jenkinsci.plugins.gwt.GenericWebHookRequestReceiver
 with:
{"Name":"administration","Queue":"administration/events/tree-queue"}

The Result is a triggered Job but with empty... body (option enabled "Print post content")

 Received:

Contributing variables:

    NAME = 

Is there a way to ignore the preflight request? I cannot find a way to disable it. Am I doing it wrong or is this a bug?

tomasbjerre commented 2 years ago

Ignoring OPTIONS in 1.80. Open issue again if any problems.

StefanIGit commented 2 years ago

thank you, now it works as expected :)