You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put an X between the brackets on this line if you have done all of the
following:
Checked that your issue isn't already filed: [open issues]
Checked the [bug report guidelines]
Description
When adding multiple query operators in urlParams in the form of an object, it throws an error. On checking it closely, it looks like the error is due to url module in applyParameters function in the source code that encodes space between the parameters as + and Twitter API expects it to be encoded as %20. The code mentioned in the examples results in the same error.
conversation_id:1305403243388829696 from:pbshgthm gets encoded as conversation_id%3A1305403243388829696%20from%3Apbshgthm
API call goes through
Actual behavior:
conversation_id:1305403243388829696 from:pbshgthm gets encoded as conversation_id%3A1305403243388829696+from%3Apbshgthm
Results in the following error
handledPromiseRejectionWarning: Error: Unauthorized at Function.module.exports.fromJson (/home/runner/threads/node_modules/twitter-v2/build/TwitterError.js:23:16)
Reproduces how often:
Always
Versions
1.1.0 (latest)
Additional Information
N.A.
The text was updated successfully, but these errors were encountered:
pbshgthm
changed the title
Error on adding multiple query parameter in search endpoint
Error on adding multiple query parameters separated by space, in urlParams
May 2, 2021
As a temporary solution, I went into the twitter.js file and added this line "url.href = url.href.replaceAll("+", "%20");" after applyParameters in the get function.
As a temporary solution, I went into the twitter.js file and added this line "url.href = url.href.replaceAll("+", "%20");" after applyParameters in the get function.
Is there a better solution? If not, we should make a PR.
Prerequisites
following:
Description
When adding multiple query operators in urlParams in the form of an object, it throws an error. On checking it closely, it looks like the error is due to url module in applyParameters function in the source code that encodes space between the parameters as
+
and Twitter API expects it to be encoded as%20
. The code mentioned in the examples results in the same error.Steps to Reproduce
node v12, v14, v16
Expected behavior:
conversation_id:1305403243388829696 from:pbshgthm
gets encoded asconversation_id%3A1305403243388829696%20from%3Apbshgthm
API call goes through
Actual behavior:
conversation_id:1305403243388829696 from:pbshgthm
gets encoded asconversation_id%3A1305403243388829696+from%3Apbshgthm
Results in the following error
handledPromiseRejectionWarning: Error: Unauthorized at Function.module.exports.fromJson (/home/runner/threads/node_modules/twitter-v2/build/TwitterError.js:23:16)
Reproduces how often:
Always
Versions
1.1.0 (latest)
Additional Information
N.A.
The text was updated successfully, but these errors were encountered: