mirror of
https://github.com/KevinMidboe/moviedb.git
synced 2025-12-29 13:21:04 +00:00
working on windows environments
This commit is contained in:
@@ -33,7 +33,7 @@ MovieDB.prototype.requestToken = function(fn){
|
||||
|
||||
request
|
||||
.get(endpoints.base_url + endpoints.authentication.requestToken)
|
||||
.send({'api_key': self.api_key})
|
||||
.query({'api_key': self.api_key})
|
||||
.set('Accept', 'application/json')
|
||||
.end(function(res){
|
||||
if(res.ok) self.token = res.body;
|
||||
@@ -77,11 +77,16 @@ var execMethod = function(type, params, endpoint, fn){
|
||||
endpoint = endpoint.replace(':id', params.id);
|
||||
type = type.toUpperCase();
|
||||
|
||||
request(type, endpoints.base_url + endpoint)
|
||||
.query({api_key : this.api_key})
|
||||
.send(params)
|
||||
.set('Accept', 'application/json')
|
||||
.end(function(res){
|
||||
var req = request(type, endpoints.base_url + endpoint)
|
||||
.query({api_key : this.api_key})
|
||||
.set('Accept', 'application/json');
|
||||
|
||||
if(type === 'GET')
|
||||
req.query(params);
|
||||
else
|
||||
req.send(params);
|
||||
|
||||
req.end(function(res){
|
||||
if(res.ok) fn(null, res.body);
|
||||
else if(res.body && res.body.status_message) fn(new Error(res.body.status_message), null);
|
||||
else fn(new Error(res.text), null);
|
||||
|
||||
Reference in New Issue
Block a user