Created
December 16, 2016 16:38
-
-
Save romgrk/2bd29cc743eb459d1e862acaf2a95a33 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Sends a GET request to the workflow | |
| const sendWorkflowRequest = (config, method, params) => { | |
| return new Promise((resolve, reject) => { | |
| // Construct request options | |
| var options = { | |
| host: config.urls.planetPress, | |
| port: config.urls.planetPressPort, | |
| path: `/${method}?${querystring.stringify(params)}`, | |
| method: 'GET' | |
| }; | |
| http.request(options, (response) => { | |
| var data = ''; | |
| response.on('data', chunk => { data += chunk; }); | |
| response.on('end', () => { | |
| resolve(data); | |
| }) | |
| response.on('error', (err) => { | |
| console.log(err); | |
| reject(err); | |
| }); | |
| }) | |
| .on('error', (err) => { | |
| console.log(err); | |
| reject(err); | |
| }) | |
| .end(); | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment