-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from danger/internals
WIP to allow Peril to run the Executor
- Loading branch information
Showing
15 changed files
with
211 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,6 @@ | |
"distribution/": true | ||
}, | ||
"files.associations": { | ||
"*.js": "javascriptreact" | ||
"**/*.js": "javascriptreact" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import fetch from "node-fetch" | ||
|
||
/** | ||
* Adds logging to every fetch request if a global var for `verbose` is set to true | ||
* | ||
* @param {(string | fetch.Request)} url the request | ||
* @param {fetch.RequestInit} [init] the usual options | ||
* @returns {Promise<fetch.Response>} network-y promise | ||
*/ | ||
export default function api(url: string | fetch.Request, init?: fetch.RequestInit): Promise<fetch.Response> { | ||
if (global.verbose && global.verbose === true) { | ||
const output = ["curl", "-i"] | ||
|
||
if (init.method) { | ||
output.push(`-X ${init.method}`) | ||
} | ||
|
||
if (init.headers) { | ||
for (const prop in init.headers) { | ||
if (init.headers.hasOwnProperty(prop)) { | ||
output.push("-H", `"${prop}: ${init.headers[prop]}"`) | ||
} | ||
} | ||
} | ||
|
||
if (init.method === "POST") { | ||
// const body:string = init.body | ||
// output.concat([init.body]) | ||
} | ||
|
||
if (typeof url === "string") { | ||
output.push(url) | ||
} | ||
|
||
console.log(output.join(" ")) // tslint:disable-line | ||
} | ||
|
||
return fetch(url, init) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.