mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-28 12:41:34 +00:00
[New] Add support for NVM_AUTH_HEADER
env var
Closes #3366 Co-authored-by: David Welch <david@davidwelch.co> Co-authored-by: Andre Kradolfer <narfdre@gmail.com>
This commit is contained in:

committed by
Jordan Harband

parent
4c7d899447
commit
bd090ef7f8
@@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
cleanup () {
|
||||
unset -f die cleanup
|
||||
unset -f die cleanup NVM_AUTH_HEADER
|
||||
docker stop httpbin && docker rm httpbin
|
||||
}
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
@@ -15,4 +16,13 @@ nvm_download "https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh" >/de
|
||||
# nvm_download should fail to download wrong_install.sh
|
||||
! nvm_download "https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/wrong_install.sh" >/dev/null || die "nvm_download should fail to download no existing file"
|
||||
|
||||
# nvm_download should pass when calling with auth header
|
||||
docker pull kennethreitz/httpbin && docker run --shell=bash -d --name httpbin -p 80:80 kennethreitz/httpbin
|
||||
sleep 1 # wait for httpbin to start
|
||||
NVM_AUTH_HEADER="Bearer test-token" nvm_download "http://127.0.0.1/bearer" > /dev/null || die 'nvm_download with auth header should send correctly'
|
||||
|
||||
# nvm_download should fail when calling without auth header
|
||||
nvm_download "http://127.0.0.1/bearer" > /dev/null && die 'nvm_download with no auth header should not send the header and should fail'
|
||||
docker stop httpbin && docker rm httpbin
|
||||
|
||||
cleanup
|
||||
|
Reference in New Issue
Block a user