mirror of
https://github.com/jaygooby/ttfb.sh
synced 2025-12-10 07:57:21 +01:00
Add a curl passthrough option -o
This lets us send custom switches to curl like -k to ignore invalid certificates. Call ttfb like this: ttfb -o "-k" https://self-signed.badssl.com
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
}
|
||||
|
||||
@test "-l logs to specific file" {
|
||||
# skip
|
||||
rundir="$(mktemp -d)"
|
||||
logdir="$(mktemp -d)"
|
||||
pwd="$PWD"
|
||||
@@ -35,6 +36,7 @@
|
||||
}
|
||||
|
||||
@test "-l exits if the path the custom log file doesn't exist" {
|
||||
# skip
|
||||
rundir="$(mktemp -d)"
|
||||
logdir="$(mktemp -d)"
|
||||
rmdir "$logdir"
|
||||
@@ -110,7 +112,6 @@
|
||||
@test "-d logs multiple requests to multiple urls to multiple custom log files" {
|
||||
# skip
|
||||
rundir="$(mktemp -d)"
|
||||
echo $rundir
|
||||
pwd="$PWD"
|
||||
cd "$rundir" && run "$pwd/ttfb" -n2 -l "$rundir/custom.log" example.com example.com/hello-world
|
||||
[ $status -eq 0 ]
|
||||
@@ -119,3 +120,12 @@
|
||||
[ $(grep " 200 OK" "$rundir/example_com-custom.log" | wc -l) -eq 2 ]
|
||||
[ $(grep " 404 Not Found" "$rundir/example_com_hello_world-custom.log" | wc -l) -eq 2 ]
|
||||
}
|
||||
|
||||
@test "pass custom curl options via our -o option" {
|
||||
# This test passes -k to curl, so it can successfully
|
||||
# call https://self-signed.badssl.com which has a self-signed certificate
|
||||
# which would normally result in a fail
|
||||
# skip
|
||||
run "$pwd/ttfb" -o "-k" https://self-signed.badssl.com
|
||||
[[ "$output" != "0" ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user