प्राप्त नहीं करता है मैं प्रोग्रामिंग के लिए जेनकिन्स नौकरियों को बनाने के लिए प्रोग्रामिंग के लिए नोड.जेएस का उपयोग करने की कोशिश कर रहा हूं।जेनकींस गिट प्लगइन पोस्ट पैरामीटर
मैं पैरामीटर को पोस्ट डेटा के रूप में भेज रहा हूं, जैसा कि नीचे दिखाया गया है। हालांकि, कोई फर्क नहीं पड़ता कि मैं ref
को कितना मूल्य आवंटित करता हूं, जेनकींस डिफ़ॉल्ट पैरामीटर मान (नौकरी की कॉन्फ़िगरेशन में निर्दिष्ट) के साथ बिल्ड चलाता है। मैंने URL में क्वेरी स्ट्रिंग के रूप में पैरामीटर में गुजरने का प्रयास किया है, लेकिन यह भी काम नहीं करता है।
मैं जेनकींस v1.651.1 और नोड v6.2.0 का उपयोग कर रहा हूं। के रूप में मैं Node.js पता नहीं है,
function makeRequest (object, callback, responseCB, postData) {
var accumulator = '';
var parsedUrl = u.parse('//' + object.url, true, true);
var options = {
hostname: parsedUrl.hostname,
port: object.port || 8080,
path: parsedUrl.path,
method: object.method || 'GET',
auth: getAuthByHost(parsedUrl.hostname)
};
if (object.headers) {
options.headers = object.headers;
}
var response = null;
var req = http.request(options, function(res) {
response = res;
res.on('data', function (data) {
accumulator = accumulator + data.toString();
res.resume();
});
res.on('close', function() {
// first assume accumulator is JSON object
var responseContent;
try {
responseContent = JSON.parse(accumulator);
}
// if not object, use accumulator as string
catch (err) {
responseContent = accumulator;
}
callback(responseContent, response.statusCode);
if (responseCB) {
responseCB(res);
}
});
});
req.on('close', function() {
// first assume accumulator is JSON object
var responseContent;
try {
responseContent = JSON.parse(accumulator);
}
catch (err) {
responseContent = accumulator;
}
callback(responseContent, response.statusCode);
if (responseCB) {
responseCB(response);
}
});
if (postData) {
req.write(postData);
}
req.end();
}
क्या आप अपनी मेकरेक्वेट विधि साझा कर सकते हैं? –
@Tizkiko ने makeRequest फ़ंक्शन –