Created
September 24, 2021 18:48
-
-
Save edilson/8b6e316eba5e7251f32c343291ec8ffa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const body = new FormData(); | |
body.append('name', activity_name); | |
body.append('data_type', 'gpx'); | |
body.append('external_id', activity_id); | |
body.append( | |
'file', | |
Buffer.from(gpxFileString, 'utf-8'), | |
`activity_${activity_id}.gpx` | |
); | |
const stravaUploadResponse = await fetch( | |
'https://www.strava.com/api/v3/uploads', | |
{ | |
method: 'POST', | |
headers: { | |
Authorization: `Bearer ${newTokens.access_token}`, | |
...body.getHeaders(), | |
}, | |
body, | |
} | |
).then(response => response.json()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment