Skip to content

Commit 1c5c221

Browse files
author
Ammar Dodin
committed
🐛 dont reassign into params
1 parent 187da7d commit 1c5c221

File tree

1 file changed

+9
-9
lines changed
  • personality-insights

1 file changed

+9
-9
lines changed

personality-insights/v2.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,36 @@ class PersonalityInsightsV2 extends BaseService {
5151
}
5252
// Content-Type
5353
let content_type = null;
54-
if (params.text) {
55-
content_type = isHTML(params.text) ? 'text/html' : 'text/plain';
54+
if (_params.text) {
55+
content_type = isHTML(_params.text) ? 'text/html' : 'text/plain';
5656
} else {
5757
content_type = 'application/json';
5858
}
5959
const headers = {
6060
'Content-type': content_type,
6161
'Accept-language':
62-
params.accept_language || params.acceptLanguage || 'en',
62+
_params.accept_language || _params.acceptLanguage || 'en',
6363
Accept: undefined
6464
};
6565
// service bug: language in header overrides language in each JSON content item, so we can't set it on those requests
6666
// (also, content-language doesn't really make sense on JSON)
67-
if (params.language || params.text) {
68-
headers['Content-language'] = params.language || 'en';
67+
if (_params.language || _params.text) {
68+
headers['Content-language'] = _params.language || 'en';
6969
}
7070
const parameters = {
7171
options: {
7272
method: 'POST',
7373
url: '/v2/profile',
74-
body: params.text || pick(params, ['contentItems']),
74+
body: _params.text || pick(_params, ['contentItems']),
7575
json: true,
76-
qs: pick(params, ['include_raw']),
76+
qs: pick(_params, ['include_raw']),
7777
headers: headers
7878
},
7979
defaultOptions: this._options
8080
};
81-
if (params.csv) {
81+
if (_params.csv) {
8282
parameters.options.headers.Accept = 'text/csv';
83-
if (params.csv_headers) {
83+
if (_params.csv_headers) {
8484
parameters.options.qs.headers = 'true';
8585
}
8686
}

0 commit comments

Comments
 (0)