-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathcurl.sh
More file actions
79 lines (53 loc) · 3.16 KB
/
curl.sh
File metadata and controls
79 lines (53 loc) · 3.16 KB
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
echo "------------------- Valid request, should work => 200 Ok -------------------\n"
curl 'http://localhost:2000/demo-api/v2/persons?limit=10' -v
echo "\n\n"
echo "------------------------ Wrong path => 404 Not Found -----------------------\n"
curl http://localhost:2000/demo-api/v2/wrong -v
echo "\n\n"
echo "----------------- Limit greater than 100 => 400 Bad Request ----------------\n"
curl 'http://localhost:2000/demo-api/v2/persons?limit=200' -v
echo "\n\n"
echo "----------------------------- Valid => 200 Ok ------------------------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer"}'
echo "\n\n"
echo "------------- Invalid UUID, email and enum => 400 Bad Request --------------\n"
curl -X PUT 'http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2+DDFC3112CE89D1' \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer","email": "jan(at)schilderei.nl","type": "ARTIST"}' -v
echo "\n\n"
echo "-------------- Wrong Content-Type => 415 Unsupported Mediatype -------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/xml' \
-d '<name>Jan</name>' -v
echo "\n\n"
echo "-------------- Required property is missing => 400 Bad Request -------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"email": "jan@predic8.de"}' -v
echo "\n\n"
echo "----------------- Additional property role => 400 Bad Request --------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer","role": "admin"}' -v
echo "\n\n"
echo "------------------ Wrong regex pattern => 400 Bad Request ------------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer","countryCode": "Germany"}' -v
echo "\n\n"
echo "---------------------- Nested Object => 201 Created ------------------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer","countryCode": "DE","address": {"city": "Bonn","street": "Koblenzer Straße 65","zip": "D-53173"}}' -v
echo "\n\n"
echo "------------- OneOf with wrong string pattern => 400 Bad Request -----------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer","countryCode": "DE","address": {"city": "Bonn","street": "Koblenzer Straße 65","zip": "D-5317"}}' -v
echo "\n\n"
echo "------------------- OneOf with right integer => 201 Created ----------------\n"
curl -X PUT http://localhost:2000/demo-api/v2/persons/4077C19D-2C1D-427B-B2DD-FC3112CE89D1 \
-H 'content-type: application/json' \
-d '{"name": "Jan Vermeer","countryCode": "DE","address": {"city": "Bonn","street": "Koblenzer Straße 65","zip": 53173}}' -v