Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added sensor to args

I mistakenly removed the sensor from args in each method,
put those back.

Also fixed the static image test. The codez worked fine,
the test did not.
  • Loading branch information...
commit 6ca5ee5a1afdb1219b5a051175c16b6de22065cc 1 parent 480d3f4
@regality regality authored
Showing with 13 additions and 3 deletions.
  1. +12 −2 lib/googlemaps.js
  2. +1 −1  test/staticmaps-test.js
View
14 lib/googlemaps.js
@@ -40,6 +40,7 @@ exports.places = function(latlng, radius, key, callback, sensor, types, lang, na
if (types) args.types = types;
if (lang) args.lang = lang;
if (name) args.name = name;
+ args.sensor = sensor || 'false';
var path = '/maps/api/place/search/json';
return makeRequest(path, args, true, returnObjectFromJSON(callback));
@@ -51,6 +52,7 @@ exports.placeDetails = function(referenceId, key, callback, sensor, lang) {
key: key
};
if (lang) args.lang = lang;
+ args.sensor = sensor || 'false';
var path = '/maps/api/place/details/json';
return makeRequest(path, args, true, returnObjectFromJSON(callback));
@@ -64,6 +66,7 @@ exports.geocode = function(address, callback, sensor, bounds, region, language)
if (bounds) args.bounds = bounds;
if (region) args.region = region;
if (language) args.language = language;
+ args.sensor = sensor || 'false';
var path = '/maps/api/geocode/json';
@@ -76,6 +79,7 @@ exports.reverseGeocode = function(latlng, callback, sensor, language ) {
'latlng': latlng
};
if (language) args.language = language;
+ args.sensor = sensor || 'false';
var path = '/maps/api/geocode/json';
@@ -92,6 +96,8 @@ exports.distance = function(origins, destinations, callback, sensor, mode, alter
if (avoid) args.avoid = avoid;
if (units) args.units = units;
if (language) args.language = language;
+ args.sensor = sensor || 'false';
+
var path = '/maps/api/distancematrix/json';
return makeRequest(path, args, false, returnObjectFromJSON(callback));
};
@@ -108,6 +114,7 @@ exports.directions = function(origin, destination, callback, sensor, mode, waypo
if (avoid) args.avoid = avoid;
if (units) args.units = units;
if (language) args.language = language;
+ args.sensor = sensor || 'false';
var path = '/maps/api/directions/json';
@@ -120,6 +127,7 @@ exports.elevationFromLocations = function(locations, callback, sensor) {
var args = {
'locations': locations
};
+ args.sensor = sensor || 'false';
var path = '/maps/api/elevation/json';
@@ -132,6 +140,7 @@ exports.elevationFromPath = function(path, samples, callback, sensor) {
'path': path,
'samples': samples
};
+ args.sensor = sensor || 'false';
var reqPath = '/maps/api/elevation/json';
var maxlen = 1500;
@@ -242,6 +251,7 @@ exports.staticMap = function(center, zoom, size, callback, sensor ,
args.path[i] = new_path.replace(/^\|/, '');
}
}
+ args.sensor = sensor || 'false';
var path = '/maps/api/staticmap';
@@ -249,7 +259,7 @@ exports.staticMap = function(center, zoom, size, callback, sensor ,
};
// http://code.google.com/apis/maps/documentation/streetview
-exports.streetView = function(size, location, callback, sensor ,
+exports.streetView = function(size, location, callback, sensor,
heading, fov, pitch) {
var args = {
'size': size,
@@ -274,6 +284,7 @@ exports.streetView = function(size, location, callback, sensor ,
}
}
+ args.sensor = sensor || 'false';
var path = '/maps/api/streetview';
return makeRequest(path, args, false, callback, 'binary');
@@ -349,7 +360,6 @@ function buildUrl(path, args) {
// If secure is true, uses https. Otherwise http is used.
var makeRequest = function(path, args, secure, callback, encoding) {
var maxlen = 2048;
- args.sensor = args.sensor || 'false';
var path = buildUrl(path, args);
if (path.length > maxlen) {
View
2  test/staticmaps-test.js
@@ -53,7 +53,7 @@ vows.describe('staticmaps').addBatch({
'returns the expected static map PNG data': function(err, data){
var md5 = crypto.createHash('md5');
md5.update(data);
- assert.equal(md5.digest('hex') , 'b601ca9a90ec103b95e13595b7e04e71');
+ assert.equal(md5.digest('hex') , 'c1cdcbce3fb2ed6d70f1843038fe59ed');
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.