Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from carl-eis/master
Browse files Browse the repository at this point in the history
Added better feedback messages for postData requests
  • Loading branch information
taylordowns2000 committed Nov 24, 2016
2 parents 750d6a3 + f2369b9 commit 01fa2ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/Adaptor.js
Expand Up @@ -279,6 +279,8 @@ function postData(params) {


return new Promise(function (resolve, reject) {
console.log("Request body:");
console.log("\n" + JSON.stringify(body, null, 4) + "\n");
_request2.default.post({
url: url,
json: body,
Expand All @@ -287,6 +289,8 @@ function postData(params) {
if (error) {
reject(error);
} else {
console.log("Printing response...\n");
console.log(JSON.stringify(response, null, 4) + "\n");
console.log("POST succeeded.");
resolve(body);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "language-http",
"version": "0.3.1",
"version": "0.3.2",
"description": "An HTTP Language Pack for OpenFn",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/Adaptor.js
Expand Up @@ -178,6 +178,8 @@ export function postData(params) {
const { url, body, headers } = expandReferences(params)(state);

return new Promise((resolve, reject) => {
console.log("Request body:");
console.log("\n" + JSON.stringify(body, null, 4) + "\n");
request.post ({
url: url,
json: body,
Expand All @@ -186,6 +188,8 @@ export function postData(params) {
if(error) {
reject(error);
} else {
console.log("Printing response...\n");
console.log(JSON.stringify(response, null, 4) + "\n");
console.log("POST succeeded.");
resolve(body);
}
Expand Down

0 comments on commit 01fa2ad

Please sign in to comment.