-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fe4787
commit 62cbad7
Showing
1 changed file
with
115 additions
and
0 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
OmgPianoTranscription/pianotranscriptioncli/src/main/resources/demo.http
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
### Successful test: check response status is 200 | ||
GET https://httpbin.org/status/200 | ||
|
||
> {% | ||
client.test("Request executed successfully", function() { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
}); | ||
%} | ||
|
||
### Failed test: check response status is 200 | ||
GET https://httpbin.org/status/404 | ||
|
||
> {% | ||
client.test("Request executed successfully", function() { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
}); | ||
%} | ||
|
||
### Check response status and content-type | ||
GET https://httpbin.org/get | ||
|
||
> {% | ||
client.test("Request executed successfully", function() { | ||
client.assert(response.status === 200, "Response status is not 200"); | ||
}); | ||
|
||
client.test("Response content-type is json", function() { | ||
var type = response.contentType.mimeType; | ||
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'"); | ||
}); | ||
%} | ||
|
||
### Check response body | ||
GET https://httpbin.org/get | ||
|
||
> {% | ||
client.test("Headers option exists", function() { | ||
client.assert(response.body.hasOwnProperty("headers"), "Cannot find 'headers' option in response"); | ||
}); | ||
%} | ||
|
||
|
||
### Send POST request with json body | ||
POST https://httpbin.org/post | ||
Content-Type: application/json | ||
|
||
{ | ||
"id": 999, | ||
"value": "content" | ||
} | ||
|
||
### Send POST request with body as parameters | ||
POST https://httpbin.org/post | ||
Content-Type: application/x-www-form-urlencoded | ||
|
||
id=999&value=content | ||
|
||
### Send a form with the text and file fields | ||
POST https://httpbin.org/post | ||
Content-Type: multipart/form-data; boundary=WebAppBoundary | ||
|
||
--WebAppBoundary | ||
Content-Disposition: form-data; name="element-name" | ||
Content-Type: text/plain | ||
|
||
Name | ||
--WebAppBoundary | ||
Content-Disposition: form-data; name="data"; filename="data.json" | ||
Content-Type: application/json | ||
|
||
< ./request-form-data.json | ||
--WebAppBoundary-- | ||
|
||
### Send request with dynamic variables in request's body | ||
POST https://httpbin.org/post | ||
Content-Type: application/json | ||
|
||
{ | ||
"id": {{$uuid}}, | ||
"price": {{$randomInt}}, | ||
"ts": {{$timestamp}}, | ||
"value": "content" | ||
} | ||
|
||
### Basic authorization. | ||
GET https://httpbin.org/basic-auth/user/passwd | ||
Authorization: Basic user passwd | ||
|
||
### Basic authorization with variables. | ||
GET https://httpbin.org/basic-auth/user/passwd | ||
Authorization: Basic {{username}} {{password}} | ||
|
||
### Digest authorization. | ||
GET https://httpbin.org/digest-auth/realm/user/passwd | ||
Authorization: Digest user passwd | ||
|
||
### Digest authorization with variables. | ||
GET https://httpbin.org/digest-auth/realm/user/passwd | ||
Authorization: Digest {{username}} {{password}} | ||
|
||
### Authorization by token, part 1. Retrieve and save token. | ||
POST https://httpbin.org/post | ||
Content-Type: application/json | ||
|
||
{ | ||
"token": "my-secret-token" | ||
} | ||
|
||
> {% client.global.set("auth_token", response.body.json.token); %} | ||
|
||
### Authorization by token, part 2. Use token to authorize. | ||
GET https://httpbin.org/headers | ||
Authorization: Bearer {{auth_token}} | ||
|
||
### |