mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-12-23 12:46:14 +00:00
Dependency Update // Support none JSON Body (#17)
* Dependency Update // Support none JSON Body * Specify action text case name
This commit is contained in:
parent
0cc64a5579
commit
3a9531bb34
5 changed files with 46 additions and 36 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
data: '{ "key": "value" }'
|
data: '{ "key": "value" }'
|
||||||
|
|
||||||
- name: Request Postment Echo POST
|
- name: Request Postment Echo POST with Unescaped Newline
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
url: 'https://postman-echo.com/post'
|
url: 'https://postman-echo.com/post'
|
||||||
|
|
50
dist/index.js
vendored
50
dist/index.js
vendored
|
@ -19,7 +19,13 @@ module.exports =
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/
|
/******/
|
||||||
/******/ // Execute the module function
|
/******/ // Execute the module function
|
||||||
|
/******/ var threw = true;
|
||||||
|
/******/ try {
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||||
|
/******/ threw = false;
|
||||||
|
/******/ } finally {
|
||||||
|
/******/ if(threw) delete installedModules[moduleId];
|
||||||
|
/******/ }
|
||||||
/******/
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.l = true;
|
/******/ module.l = true;
|
||||||
|
@ -678,19 +684,12 @@ module.exports = function xhrAdapter(config) {
|
||||||
delete requestHeaders['Content-Type']; // Let the browser set it
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
(utils.isBlob(requestData) || utils.isFile(requestData)) &&
|
|
||||||
requestData.type
|
|
||||||
) {
|
|
||||||
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
// HTTP basic authentication
|
// HTTP basic authentication
|
||||||
if (config.auth) {
|
if (config.auth) {
|
||||||
var username = config.auth.username || '';
|
var username = config.auth.username || '';
|
||||||
var password = unescape(encodeURIComponent(config.auth.password)) || '';
|
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
||||||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,12 +1032,14 @@ const request = async({ method, instanceConfig, data, auth, actions, preventFail
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const jsonData = method === METHOD_GET ? undefined : JSON.parse(data)
|
if (method === METHOD_GET) {
|
||||||
|
data = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const requestData = {
|
const requestData = {
|
||||||
auth,
|
auth,
|
||||||
method,
|
method,
|
||||||
data: jsonData
|
data
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.debug('Request Data: ' + JSON.stringify(requestData))
|
actions.debug('Request Data: ' + JSON.stringify(requestData))
|
||||||
|
@ -1082,7 +1083,7 @@ module.exports = require("assert");
|
||||||
/***/ 361:
|
/***/ 361:
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
module.exports = {"_from":"axios@0.20.0","_id":"axios@0.20.0","_inBundle":false,"_integrity":"sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.20.0","name":"axios","escapedName":"axios","rawSpec":"0.20.0","saveSpec":null,"fetchSpec":"0.20.0"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.20.0.tgz","_shasum":"057ba30f04884694993a8cd07fa394cff11c50bd","_spec":"axios@0.20.0","_where":"/Users/frankjogeleit/Workspace/actions/http-request-action","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundleDependencies":false,"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.10.0"},"deprecated":false,"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"homepage":"https://github.com/axios/axios","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test && bundlesize","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.20.0"};
|
module.exports = {"_from":"axios@0.21.0","_id":"axios@0.21.0","_inBundle":false,"_integrity":"sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.0","name":"axios","escapedName":"axios","rawSpec":"0.21.0","saveSpec":null,"fetchSpec":"0.21.0"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.0.tgz","_shasum":"26df088803a2350dff2c27f96fef99fe49442aca","_spec":"axios@0.21.0","_where":"/Users/frankjogeleit/Workspace/actions/http-request-action","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundleDependencies":false,"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.10.0"},"deprecated":false,"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"homepage":"https://github.com/axios/axios","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test && bundlesize","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.0"};
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
@ -2021,7 +2022,7 @@ function wrap(protocols) {
|
||||||
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
||||||
|
|
||||||
// Executes a request, following redirects
|
// Executes a request, following redirects
|
||||||
wrappedProtocol.request = function (input, options, callback) {
|
function request(input, options, callback) {
|
||||||
// Parse parameters
|
// Parse parameters
|
||||||
if (typeof input === "string") {
|
if (typeof input === "string") {
|
||||||
var urlStr = input;
|
var urlStr = input;
|
||||||
|
@ -2056,14 +2057,20 @@ function wrap(protocols) {
|
||||||
assert.equal(options.protocol, protocol, "protocol mismatch");
|
assert.equal(options.protocol, protocol, "protocol mismatch");
|
||||||
debug("options", options);
|
debug("options", options);
|
||||||
return new RedirectableRequest(options, callback);
|
return new RedirectableRequest(options, callback);
|
||||||
};
|
}
|
||||||
|
|
||||||
// Executes a GET request, following redirects
|
// Executes a GET request, following redirects
|
||||||
wrappedProtocol.get = function (input, options, callback) {
|
function get(input, options, callback) {
|
||||||
var request = wrappedProtocol.request(input, options, callback);
|
var wrappedRequest = wrappedProtocol.request(input, options, callback);
|
||||||
request.end();
|
wrappedRequest.end();
|
||||||
return request;
|
return wrappedRequest;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
// Expose the properties on the wrapped protocol
|
||||||
|
Object.defineProperties(wrappedProtocol, {
|
||||||
|
request: { value: request, configurable: true, enumerable: true, writable: true },
|
||||||
|
get: { value: get, configurable: true, enumerable: true, writable: true },
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
@ -2828,7 +2835,8 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
||||||
Axios.prototype[method] = function(url, config) {
|
Axios.prototype[method] = function(url, config) {
|
||||||
return this.request(mergeConfig(config || {}, {
|
return this.request(mergeConfig(config || {}, {
|
||||||
method: method,
|
method: method,
|
||||||
url: url
|
url: url,
|
||||||
|
data: (config || {}).data
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -3097,9 +3105,9 @@ module.exports = function combineURLs(baseURL, relativeURL) {
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 944:
|
/***/ 944:
|
||||||
/***/ (function() {
|
/***/ (function(module) {
|
||||||
|
|
||||||
eval("require")("debug");
|
module.exports = eval("require")("debug");
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
18
package-lock.json
generated
18
package-lock.json
generated
|
@ -11,22 +11,22 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@zeit/ncc": {
|
"@zeit/ncc": {
|
||||||
"version": "0.21.1",
|
"version": "0.22.3",
|
||||||
"resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.21.1.tgz",
|
"resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.22.3.tgz",
|
||||||
"integrity": "sha512-M9WzgquSOt2nsjRkYM9LRylBLmmlwNCwYbm3Up3PDEshfvdmIfqpFNSK8EJvR18NwZjGHE5z2avlDtYQx2JQnw=="
|
"integrity": "sha512-jnCLpLXWuw/PAiJiVbLjA8WBC0IJQbFeUwF4I9M+23MvIxTxk5pD4Q8byQBSPmHQjz5aBoA7AKAElQxMpjrCLQ=="
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.20.0",
|
"version": "0.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz",
|
||||||
"integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
|
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "^1.10.0"
|
"follow-redirects": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"follow-redirects": {
|
"follow-redirects": {
|
||||||
"version": "1.13.0",
|
"version": "1.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||||
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
|
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"@actions/core": "^1.2.6"
|
"@actions/core": "^1.2.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@zeit/ncc": "^0.21.1",
|
"@zeit/ncc": "^0.22",
|
||||||
"axios": "^0.20.0"
|
"axios": "^0.21"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,14 @@ const request = async({ method, instanceConfig, data, auth, actions, preventFail
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const jsonData = method === METHOD_GET ? undefined : JSON.parse(data)
|
if (method === METHOD_GET) {
|
||||||
|
data = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const requestData = {
|
const requestData = {
|
||||||
auth,
|
auth,
|
||||||
method,
|
method,
|
||||||
data: jsonData
|
data
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.debug('Request Data: ' + JSON.stringify(requestData))
|
actions.debug('Request Data: ' + JSON.stringify(requestData))
|
||||||
|
|
Loading…
Reference in a new issue