Skip to content

Commit 878af22

Browse files
committed
drop! Add endpoint to return a 503 response
1 parent 7314c8f commit 878af22

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

lambdas/service/app.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
from azul.auth import (
4646
OAuth2,
4747
)
48+
from azul.chalice import (
49+
ServiceUnavailableError,
50+
)
4851
from azul.collections import (
4952
OrderedSet,
5053
)
@@ -591,6 +594,14 @@ def __call__(self, param):
591594
}
592595

593596

597+
@app.route(
598+
'/error-503',
599+
spec={'summary': 'test endpoint for a 503 status response'}
600+
)
601+
def error_503():
602+
raise ServiceUnavailableError()
603+
604+
594605
@app.route(
595606
'/index/catalogs',
596607
methods=['GET'],

lambdas/service/openapi.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,31 @@
900900
]
901901
}
902902
},
903+
"/error-503": {
904+
"get": {
905+
"responses": {
906+
"400": {
907+
"description": "Bad request. The request was rejected due to malformed parameters."
908+
},
909+
"429": {
910+
"description": "Too many requests. \nWhen handling this response, clients should wait the number of seconds\nspecified in the `Retry-After` header and then retry the request.\n"
911+
},
912+
"500": {
913+
"description": "Internal server error. An internal server error occurred."
914+
},
915+
"502": {
916+
"description": "Bad gateway. The server received an invalid response from the upstream server."
917+
},
918+
"503": {
919+
"description": "Service unavailable. \nWhen handling this response, clients should wait the number of seconds\nspecified in the `Retry-After` header and then retry the request.\n"
920+
},
921+
"504": {
922+
"description": "Gateway timeout. The server did not respond in time. Please try again later."
923+
}
924+
},
925+
"summary": "test endpoint for a 503 status response"
926+
}
927+
},
903928
"/index/catalogs": {
904929
"get": {
905930
"responses": {

0 commit comments

Comments
 (0)