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

Commit

Permalink
Fix content language (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilwebster authored and germanattanasio committed Feb 8, 2017
1 parent cf3ea1e commit c70a947
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions helpers/personality-insights.js
Expand Up @@ -46,15 +46,20 @@ const toContentItem = (tweet) => {
};

const getProfile = (params) =>
new Promise((resolve, reject) =>
personalityInsights.profile(params, (err, profile) => {
new Promise((resolve, reject) => {
if (params.language) {
params.headers = {
'Content-Language': params.language,
};
}
return personalityInsights.profile(params, (err, profile) => {
if (err) {
reject(err);
} else {
resolve(profile);
}
})
);
});
});

const profileFromTweets = (params) => (tweets) => {
params.content_items = tweets.map(toContentItem);
Expand Down

0 comments on commit c70a947

Please sign in to comment.