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

Commit 45327de

Browse files
authored
Merge pull request #56 from OpenFn/55-undefined-log-message
Avoid displaying `undefined` value in `create` log message
2 parents f94094f + 65cefea commit 45327de

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

lib/Adaptor.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ function create(resourceType, data, options = {}, callback = false) {
322322
data: (0, _Utils.nestArray)(data, resourceType),
323323
...requestConfig
324324
}).then(result => {
325-
_Utils.Log.success(`Created ${resourceType}: ${result.headers.location}`);
325+
const {
326+
data
327+
} = result;
328+
const details = `with response ${JSON.stringify(data, null, 2)}`;
329+
330+
_Utils.Log.success(`Created ${resourceType} ${details}`);
326331

327332
return (0, _Utils.handleResponse)(result, state, callback);
328333
});

src/Adaptor.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ export function create(resourceType, data, options = {}, callback = false) {
235235
data: nestArray(data, resourceType),
236236
...requestConfig,
237237
}).then(result => {
238-
Log.success(`Created ${resourceType}: ${result.headers.location}`);
238+
const { data } = result;
239+
const details = `with response ${JSON.stringify(data, null, 2)}`;
240+
241+
Log.success(`Created ${resourceType} ${details}`);
239242
return handleResponse(result, state, callback);
240243
});
241244
};

test/integration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('Integration tests', () => {
247247
configuration: {
248248
username: 'admin',
249249
password: 'district',
250-
hostUrl: 'https://play.dhis2.org/2.36.4',
250+
hostUrl: 'https://play.dhis2.org/2.37.2',
251251
},
252252
data: {},
253253
};

0 commit comments

Comments
 (0)