Skip to content

Instantly share code, notes, and snippets.

@garrytrinder
Created August 28, 2024 10:07
Show Gist options
  • Save garrytrinder/d6a42b7b32405e4b288bbd3bbb5e6c9a to your computer and use it in GitHub Desktop.
Save garrytrinder/d6a42b7b32405e4b288bbd3bbb5e6c9a to your computer and use it in GitHub Desktop.
Code snippets for Dev Proxy 0.20 release announcement
{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.20.0/genericrandomerrorplugin.schema.json",
"errors": [
{
"request": {
"url": "https://jsonplaceholder.typicode.com/*"
},
"responses": [
{
"statusCode": 400,
"body": {
"message": "Bad Request",
"details": "The server cannot process the request due to invalid syntax."
}
},
{
"statusCode": 401,
"body": {
"message": "Unauthorized",
"details": "The request requires user authentication."
}
},
{
"statusCode": 403,
"body": {
"message": "Forbidden",
"details": "The server understood the request, but refuses to authorize it."
}
},
{
"statusCode": 404,
"body": {
"message": "Not Found",
"details": "The requested resource could not be found."
}
},
{
"statusCode": 418,
"body": {
"message": "I'm a teapot",
"details": "The server refuses the attempt to brew coffee with a teapot."
}
},
{
"statusCode": 429,
"body": {
"message": "Too Many Requests",
"details": "The user has sent too many requests in a given amount of time (\"rate limiting\")."
},
"headers": [
{
"name": "Retry-After",
"value": "@dynamic"
}
]
}
]
}
{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.19.1/genericrandomerrorplugin.schema.json",
"responses": [
{
"statusCode": 400,
"body": {
"message": "Bad Request",
"details": "The server cannot process the request due to invalid syntax."
}
},
{
"statusCode": 429,
"body": {
"message": "Too Many Requests",
"details": "The user has sent too many requests in a given amount of time (\"rate limiting\")."
},
"headers": [
{
"name": "Retry-After",
"value": "@dynamic"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment