-
Notifications
You must be signed in to change notification settings - Fork 85
/
curl.sh
executable file
·91 lines (78 loc) · 1.78 KB
/
curl.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
PROGNAME=${0##*/}
PROGVERSION=1.0.1
usage()
{
cat << EO
Usage: $PROGNAME [options]
$PROGNAME -o <version> -c
Increase the .deb file's version number, noting the change in the
Options:
EO
cat <<EO | column -s\& -t
-h|--help & show this output
-V|--version & show version information
EO
}
n=1000
c=10
json_file=REQUEST__SHORT_NOROOT_STRING.json
SHORTOPTS="hvta:"
LONGOPTS="help,version,auction,mock-bidders,bidder,multi-bidder,ico-bidder,c:n:"
ARGS=$(getopt -s bash --options $SHORTOPTS \
--longoptions $LONGOPTS --name $PROGNAME -- "$@" )
eval set -- "$ARGS"
while true; do
case $1 in
-h|--help)
usage
exit 0
;;
-v|--version)
echo "$PROGVERSION"
;;
-a)
shift
echo "$1"
;;
-n|--num_of_requests)
shift
n=$1
;;
-c|--concurrency)
shift
c=$1
;;
--mock-bidders)
CMD=http://localhost:8081/openrtb_handler/mock-bidders/auction/123
;;
--auction)
CMD=http://localhost:8081/openrtb_handler/auction/123
;;
--bidder)
CMD=http://localhost:9081/bid/123
json_file=BID_REQUEST_BANNER.json
;;
--ico-bidder)
CMD=http://localhost:9082/ico_bid/123
json_file=ICO_BID_REQUEST_BANNER.json
;;
--multi-bidder)
CMD=http://localhost:9090/bid/
json_file=BID_REQUEST_BANNER.json
;;
--)
shift
break
;;
*)
shift
break
;;
esac
shift
done
CURL_CMD=`curl -X POST -H "Content-Type: application/json" --data @${json_file} ${CMD}`
echo ${CURL_CMD}
output=`${CURL_CMD} 2> /dev/null`
echo $output