diff --git a/lib/geocoder/tomtomgeocoder.js b/lib/geocoder/tomtomgeocoder.js index 0266ef1..0e73611 100644 --- a/lib/geocoder/tomtomgeocoder.js +++ b/lib/geocoder/tomtomgeocoder.js @@ -155,7 +155,7 @@ TomTomGeocoder.prototype.__createJob = async function (addresses) { if (!location) { throw new Error('Location header not found'); } - return location; + return (new URL(location, response.url)).href }; TomTomGeocoder.prototype.__pollJobStatusAndFetchResults = async function ( @@ -186,6 +186,7 @@ TomTomGeocoder.prototype.__pollJobStatusAndFetchResults = async function ( if (!newLocation) { throw new Error('Location header not found'); } + newLocation = (new URL(newLocation, status.url)).href } else if (status.status === 429) { throw new Error('Provider error: Too many requests'); } else {