Skip to content

Commit cbad20a

Browse files
committed
chore: status/http README
1 parent 63239b1 commit cbad20a

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ Example query `property_street_number`, `property_street_number_sfx`, `property_
5858
$ curl https://<host>/api/abe/json?$select=property_street_number,property_street_number_sfx,property_street_name,property_street_sfx,property_unit,block,lot&$where=block%20=%270834%27%20AND%20lot=%27144%27
5959
```
6060

61+
## `api/status/http`
62+
63+
Query http status of the serverless function.
64+
65+
### Query
66+
67+
Example
68+
69+
```sh
70+
curl https://<host>/api/status/http
71+
72+
{"status": "success", "data": {"message": "200 OK"}}
73+
```
6174

6275
## Deployment notes
6376
#### :warning: [Linux Consumption] Successful slot swaps automatically reverted after a few minutes :warning:

status_http/__init__.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" status/http init file """
2+
23
import os
34
import json
45
import logging
@@ -9,26 +10,25 @@
910
from requests.models import Response
1011
from shared_code.common import func_jsend_response
1112

13+
1214
def main(req: func.HttpRequest) -> func.HttpResponse:
13-
""" main function for status/http """
14-
logging.info('Status processed a request.')
15+
"""main function for status/http"""
16+
logging.info("Status processed a request.")
1517

1618
try:
1719
if req.get_body() and len(req.get_body()):
1820
status_code = 202
1921
# pylint: disable=protected-access
20-
body = "202 Accepted"
22+
body = {"message": "202 Accepted"}
2123
else:
2224
status_code = 200
2325
# pylint: disable=protected-access
24-
body = "200 OK"
26+
body = {"message": "200 OK"}
2527

26-
headers = {
27-
"Access-Control-Allow-Origin": "*"
28-
}
28+
headers = {"Access-Control-Allow-Origin": "*"}
2929
return func_jsend_response(body, headers, status_code)
3030

31-
#pylint: disable=broad-except
31+
# pylint: disable=broad-except
3232
except Exception as err:
3333
logging.error("Status HTTP error occurred: %s", traceback.format_exc())
3434
msg_error = f"This endpoint encountered an error. {err}"

0 commit comments

Comments
 (0)