Skip to content

Commit

Permalink
Only pass authorization header if value is not undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Irene Alvarado committed May 28, 2021
1 parent ff73f51 commit 73580df
Show file tree
Hide file tree
Showing 7 changed files with 127,917 additions and 192,155 deletions.
1,202 changes: 911 additions & 291 deletions dist/LICENSE

Large diffs are not rendered by default.

318,835 changes: 126,987 additions & 191,848 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions dist/post/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports =
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
Expand Down Expand Up @@ -1757,9 +1758,8 @@ module.exports = require("util");;
/******/ // The require function
/******/ function __nccwpck_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
Expand All @@ -1784,13 +1784,10 @@ module.exports = require("util");;
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
/******/
/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
/******/ // module exports must be returned from runtime so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __nccwpck_require__(95);
/******/ module.exports = __webpack_exports__;
/******/
/******/ return __nccwpck_require__(95);
/******/ })()
;
2 changes: 1 addition & 1 deletion dist/sourcemap-register.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions src/backends/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ import axios from 'axios'

export default async function fetchHTTP(config: HTTPConfig): Promise<string> {
core.info('Fetching: HTTP')

// Authorization headers
const auth = {
headers: {
authorization: config.authorization,
}
};
const headers = config.authorization ? auth : {}
core.info(headers.toString());

try {
const response = await axios.get(config.http_url, {
method: 'get',
responseType: 'stream',
headers: {
authorization: config.authorization,
},
...headers,
})
const filename = config.downloaded_filename
const writer = fs.createWriteStream(filename)
let bytesWritten = 0
response.data.pipe(writer)
await new Promise((resolve, reject) => {
writer.on('finish', resolve)
Expand Down

0 comments on commit 73580df

Please sign in to comment.