Skip to content
Permalink
Browse files

Fix request to Netflix API (#99)

  • Loading branch information...
gsrafael01 committed Mar 10, 2019
1 parent 5e3be85 commit e337f357ba86240f7c49d5a9c0916dc70b6aab7a
Showing with 3 additions and 6 deletions.
  1. +1 −4 src/class/NetflixApiUtils.js
  2. +2 −2 src/class/Request.js
@@ -189,10 +189,7 @@ const netflixApiUtils = {
return new Promise(resolve => {
Request.send({
method: `POST`,
params: {
authURL: this.authUrl,
paths: activities.map(activity => [`videos`, activity.movieID, [`releaseYear`, `summary`]])
},
params: `authURL=${this.authUrl}&${activities.map(activity => `path=["videos",${activity.movieID},["releaseYear","summary"]]`).join(`&`)}`,
url: `${NETFLIX_API_HOST}/${this.buildIdentifier}/pathEvaluator?languages=en-US`,
success: response => {
const json = JSON.parse(response);
@@ -6,7 +6,7 @@ class Request {
const storage = await BrowserStorage.get(`data`);
const xhr = new XMLHttpRequest();
xhr.open(options.method, options.url, true);
xhr.setRequestHeader(`Content-Type`, `application/json`);
xhr.setRequestHeader(`Content-Type`, typeof options.params === `string` ? `application/x-www-form-urlencoded` : `application/json`);
xhr.setRequestHeader(`trakt-api-key`, Settings.clientId);
xhr.setRequestHeader(`trakt-api-version`, Settings.apiVersion);
if (storage.data && storage.data.access_token) {
@@ -31,7 +31,7 @@ class Request {
params: options.params
});
};
xhr.send(JSON.stringify(options.params));
xhr.send(typeof options.params === `string` ? options.params : JSON.stringify(options.params));
}

send(options) {

0 comments on commit e337f35

Please sign in to comment.
You can’t perform that action at this time.