-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtest.http
56 lines (43 loc) · 1.85 KB
/
test.http
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
@xsuaaHostname = <<credentials.url - field from xsuaa section of default-env.json>>
@xsuaaClient = <<credentials.clientid - field from xsuaa section of default-env.json>>
@xsuaaSecret = <<credentials.clientsecret - field from xsuaa section of default-env.json>>
@host = <<service url after deployment>>
@protocol = https
### Request-1 Get xsuaa token
#==================================================================#
# @name getXsuaaToken
POST {{xsuaaHostname}}/oauth/token
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Authorization: Basic {{xsuaaClient}}:{{xsuaaSecret}}
client_id={{xsuaaClient}}
&client_secret={{xsuaaSecret}}
&grant_type=client_credentials
### Store access token
@access_token = {{getXsuaaToken.response.body.$.access_token}}
### Request-2 Create entry in MediaFiles
#==================================================================#
# @name postMediaEntry
POST {{protocol}}://{{host}}/media/MediaFiles
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"type": "text/plain",
"filename": "malware.test.txt"
}
### Request-3 Update file with Malware
#==================================================================#
PUT {{protocol}}://{{host}}/media/MediaFiles({{postMediaEntry.response.body.$.ID}})/content
Authorization: Bearer {{access_token}}
Content-Type: text/plain
< ./srv/malware.test.txt
### Request-4 PUT Request
#==================================================================#
PUT {{protocol}}://{{host}}/media/MediaFiles({{postMediaEntry.response.body.$.ID}})/content
Authorization: Bearer {{access_token}}
Content-Type: text/plain
< ./srv/test.txt
### Request-5 Read file Content
#==================================================================#
GET {{protocol}}://{{host}}/media/MediaFiles({{postMediaEntry.response.body.$.ID}})/content
Authorization: Bearer {{access_token}}