Created
March 12, 2019 20:01
-
-
Save draco2003/a84f410d3cc76267139fc9816dd52f4a to your computer and use it in GitHub Desktop.
NEL Report Tester
This file contains 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
#!/usr/bin/env bash | |
if [ $# -lt 2 ] | |
then | |
echo "Usage: neltest.sh report_to test" | |
echo "" | |
echo "report_to: is the host to send the error report to" | |
echo "" | |
echo "test: 1 | 2 | 3" | |
echo " 1: single NEL report test" | |
echo " 2: multi NEL report test" | |
echo " 3: both tests" | |
exit 1 | |
fi | |
test_repo="https://raw.githubusercontent.com/google/nel-collector/master/pkg/collector/testdata/TestNelReport/" | |
report_to=$1 | |
test_type=$2 | |
send_report () { | |
curl -i \ | |
-H "Accept: application/json" \ | |
-H "Content-Type:application/json" \ | |
-X POST --data "$1" "$report_to" | |
} | |
if [ $2 -eq 1 ] || [ $2 -eq 3 ]; then | |
echo "" | |
echo "Running Single NEL Report Test.." | |
single_report="$(curl -s $test_repo"valid-nel-report.json")" | |
send_report "$single_report" | |
fi | |
if [ $2 -eq 2 ] || [ $2 -eq 3 ]; then | |
echo "" | |
echo "Running Multi NEL Report Test.." | |
multi_report="$(curl -s $test_repo"multiple-valid-nel-reports.json")" | |
send_report "$multi_report" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment