Skip to content

Commit

Permalink
Merge pull request #12 from CartoDB/fix-for-recent-fetch
Browse files Browse the repository at this point in the history
fix: tomtom batch geocoder for node-fetch >= 3.1.1
  • Loading branch information
jgoizueta authored Dec 5, 2023
2 parents fb79263 + ca6531e commit f42f64d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/geocoder/tomtomgeocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f42f64d

Please sign in to comment.