Add User-Agent header to outgoing HTTP requests #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Excludes requests made by the AWS SDK to read/write data in S3, but includes all other HTTP requests made during operation, e.g. when getting changeset metadata from the OSM API, or when querying the Overpass server.
The header is formatted as
User-Agent: OSMCha osm-adiff-service 1.0.0
This PR also replaces the Node
http
module for the 3rd-partynode-fetch
which implements the WhatWG Fetch API. Using Fetch simplifies the HTTP request code somewhat since it supports promises and URL parsing, whichhttp
does not. Node 21 includes native support for fetch so at some point if we update Node we can drop the third-partynode-fetch
dependency.I've tested this change locally by running
yarn process <replication-id>
. However to do so I had to modifyindex.js
significantly, removing the S3 API calls and using plain HTTP to read data from S3 (and skip writing data entirely). I'm reasonably sure that I still hit all of the important code paths, but let me know if there's a better way to test this code.