This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurler.sh
executable file
·68 lines (60 loc) · 1.99 KB
/
curler.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
internalErrorURL=(
"http://localhost:8080/internal"
"http://localhost:8080/internal?currentUserID=1"
"http://localhost:8080/internal?currentUserID=4"
"http://localhost:8080/internal?currentUserID=4&name=Maria"
"http://localhost:8080/internal?currentUserID=4&name=Nushi"
"http://localhost:8080/internal?currentUserID=4&name=Mohammed"
"http://localhost:8080/internal?currentUserID=4&name=Jose"
"http://localhost:8080/internal?currentUserID=4&name=Wei"
)
publicErrorURL=(
"http://localhost:8080/public"
"http://localhost:8080/public?currentUserID=1"
"http://localhost:8080/public?currentUserID=4"
"http://localhost:8080/public?currentUserID=4&name=Maria"
"http://localhost:8080/public?currentUserID=4&name=Nushi"
"http://localhost:8080/public?currentUserID=4&name=Mohammed"
"http://localhost:8080/public?currentUserID=4&name=Jose"
"http://localhost:8080/public?currentUserID=4&name=Wei"
)
publicWithMidErrorURL=(
"http://localhost:8080/mid"
"http://localhost:8080/mid?currentUserID=1"
"http://localhost:8080/mid?currentUserID=4"
"http://localhost:8080/mid?currentUserID=4&name=Maria"
"http://localhost:8080/mid?currentUserID=4&name=Nushi"
"http://localhost:8080/mid?currentUserID=4&name=Mohammed"
"http://localhost:8080/mid?currentUserID=4&name=Jose"
"http://localhost:8080/mid?currentUserID=4&name=Wei"
)
function curlBinData {
local res=$(curl -s -w "%{http_code}" $1)
local body=${res::-3}
local status=$(printf "%s" "$res" | tail -c 3)
echo -e "$status\t\t\t| $body"
}
echo "Internal Errors"
echo
echo -e "HTTP Status Code\t|\tRespoonse"
for i in ${!internalErrorURL[@]};
do
curlBinData ${internalErrorURL[$i]}
done
echo
echo "Public Errors"
echo
echo -e "HTTP Status Code\t|\tRespoonse"
for i in ${!publicErrorURL[@]};
do
curlBinData ${publicErrorURL[$i]}
done
echo
echo "Public With Middleware Errors"
echo
echo -e "HTTP Status Code\t|\tRespoonse"
for i in ${!publicWithMidErrorURL[@]};
do
curlBinData ${publicWithMidErrorURL[$i]}
done