Skip to content
Advertisement

How to download a file when a custom header is needed?

I want to download from a private repository in GitHub, so I need to pass the headers Authorization: token ${GITHUB_TOKEN} and Accept: application/vnd.github.v3.raw.

For example, with curl: curl -H "Authorization: token ${GITHUB_TOKEN}" -H 'Accept: application/vnd.github.v3.raw' -o file.yaml -L https://api.github.com/repos/<owner>/<repo>/contents/file.yaml

Looking for information about how to download a file in Kotlin, I found a few examples, and I’m using the following:

JavaScript

How can I pass those two headers?

Advertisement

Answer

Found a link that helped me with this:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement