-
Notifications
You must be signed in to change notification settings - Fork 1
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
pingzhou
committed
Nov 25, 2021
1 parent
aae5840
commit bdd3efa
Showing
3 changed files
with
138 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# timeout-checker | ||
A simple wait and response api to test retry& timeout. Yep! Everyone loves retry and timeout test 🤠 | ||
|
||
Install via brew | ||
## Install via brew | ||
``` | ||
$ brew tap applegreengrape/timeout-checker https://github.com/applegreengrape/timeout-checker | ||
$ brew install timeout-checker | ||
``` | ||
server side: | ||
``` | ||
$ checker-api -wait 5 -port 8081 | ||
$ checker-api -wait 3 -port 8081 | ||
2021/11/22 15:21:30 wait 3 second | ||
2021/11/22 15:21:30 received | ||
2021/11/22 15:21:33 returned | ||
|
@@ -25,3 +25,63 @@ $ curl http://localhost:8081/healthcheck | |
$ curl http://localhost:8081/healthcheck | ||
{"status":"up"} | ||
``` | ||
|
||
## Customize api response | ||
server side: | ||
``` | ||
$ go run main.go -path '/v1/api/echo' -payload echo.json | ||
2021/11/25 16:25:43 wait 3 second | ||
2021/11/25 16:25:43 received | ||
2021/11/25 16:25:46 returned | ||
``` | ||
|
||
client side: | ||
``` | ||
$ curl -X POST http://localhost:8080/v1/api/echo | ||
{ | ||
"_id": "619fb7e74eb6e971b55f410a", | ||
"index": 0, | ||
"guid": "32316e07-db6a-437d-887c-6d0c34ee805a", | ||
"isActive": true, | ||
"balance": "$2,259.93", | ||
"picture": "http://placehold.it/32x32", | ||
"age": 36, | ||
"eyeColor": "blue", | ||
"name": "Jan Crane", | ||
"gender": "female", | ||
"company": "COMVEY", | ||
"email": "[email protected]", | ||
"phone": "+1 (953) 460-3063", | ||
"address": "962 Lorraine Street, Hayden, Texas, 2598", | ||
"about": "Est aute exercitation laborum ipsum ad non sit laborum officia. Exercitation cupidatat consequat ea id aute cillum minim veniam Lorem cupidatat consectetur sit esse excepteur. Ex fugiat tempor dolore Lorem et nulla veniam quis in esse. Non est deserunt consequat aute do pariatur laborum amet labore eu ex culpa sit ipsum. Laboris duis nulla voluptate proident. Fugiat sint anim minim anim cupidatat veniam nulla dolore qui labore aute fugiat anim ipsum.\r\n", | ||
"registered": "2018-10-29T11:51:37 -00:00", | ||
"latitude": 65.197781, | ||
"longitude": 46.290158, | ||
"tags": [ | ||
"minim", | ||
"ipsum", | ||
"tempor", | ||
"in", | ||
"sit", | ||
"culpa", | ||
"dolore" | ||
], | ||
"friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Camille Hopkins" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Alyssa Contreras" | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Burton Haney" | ||
} | ||
], | ||
"greeting": "Hello, Jan Crane! You have 6 unread messages.", | ||
"favoriteFruit": "strawberry" | ||
} | ||
``` | ||
So you should be able to customiz the api path and response |
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,45 @@ | ||
{ | ||
"_id": "619fb7e74eb6e971b55f410a", | ||
"index": 0, | ||
"guid": "32316e07-db6a-437d-887c-6d0c34ee805a", | ||
"isActive": true, | ||
"balance": "$2,259.93", | ||
"picture": "http://placehold.it/32x32", | ||
"age": 36, | ||
"eyeColor": "blue", | ||
"name": "Jan Crane", | ||
"gender": "female", | ||
"company": "COMVEY", | ||
"email": "[email protected]", | ||
"phone": "+1 (953) 460-3063", | ||
"address": "962 Lorraine Street, Hayden, Texas, 2598", | ||
"about": "Est aute exercitation laborum ipsum ad non sit laborum officia. Exercitation cupidatat consequat ea id aute cillum minim veniam Lorem cupidatat consectetur sit esse excepteur. Ex fugiat tempor dolore Lorem et nulla veniam quis in esse. Non est deserunt consequat aute do pariatur laborum amet labore eu ex culpa sit ipsum. Laboris duis nulla voluptate proident. Fugiat sint anim minim anim cupidatat veniam nulla dolore qui labore aute fugiat anim ipsum.\r\n", | ||
"registered": "2018-10-29T11:51:37 -00:00", | ||
"latitude": 65.197781, | ||
"longitude": 46.290158, | ||
"tags": [ | ||
"minim", | ||
"ipsum", | ||
"tempor", | ||
"in", | ||
"sit", | ||
"culpa", | ||
"dolore" | ||
], | ||
"friends": [ | ||
{ | ||
"id": 0, | ||
"name": "Camille Hopkins" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "Alyssa Contreras" | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Burton Haney" | ||
} | ||
], | ||
"greeting": "Hello, Jan Crane! You have 6 unread messages.", | ||
"favoriteFruit": "strawberry" | ||
} |
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