commit 43a0aef29fdf4bb1c3bddce39870bdd6b8d0878c
parent 6f45db6a01e162b62837c7280b049673d6908f17
Author: Joris Vink <joris@coders.se>
Date: Tue, 10 Apr 2018 14:35:52 +0200
prefix HTTP defines when exporting them to python.
Diffstat:
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/examples/python/src/index.py b/examples/python/src/index.py
@@ -76,7 +76,7 @@ def page(req):
xframe = req.request_header("xframe")
if xframe != None:
kore.log(kore.LOG_INFO, "xframe header present: '%s'" % xframe)
- if req.method == kore.METHOD_POST:
+ if req.method == kore.HTTP_METHOD_POST:
try:
length, body = req.body_read(1024)
kore.log(kore.LOG_INFO, "POST and got %d bytes! (%s)" %
@@ -102,7 +102,7 @@ def page(req):
# Handler that parses the incoming body as JSON and dumps out some things.
#
def json_parse(req):
- if req.method != kore.METHOD_PUT:
+ if req.method != kore.HTTP_METHOD_PUT:
req.response(400, b'')
else:
data = json.loads(req.body)
diff --git a/examples/python/src/upload.py b/examples/python/src/upload.py
@@ -24,7 +24,7 @@ import kore
#
def upload(req):
# We only allow POST's.
- if req.method is not kore.METHOD_POST:
+ if req.method is not kore.HTTP_METHOD_POST:
req.response_header("allow", "post")
req.response(400, b'')
return
diff --git a/src/python.c b/src/python.c
@@ -104,13 +104,13 @@ static struct {
{ "CONN_PROTO_UNKNOWN", CONN_PROTO_UNKNOWN },
{ "CONN_PROTO_WEBSOCKET", CONN_PROTO_WEBSOCKET },
{ "CONN_STATE_ESTABLISHED", CONN_STATE_ESTABLISHED },
- { "METHOD_GET", HTTP_METHOD_GET },
- { "METHOD_PUT", HTTP_METHOD_PUT },
- { "METHOD_HEAD", HTTP_METHOD_HEAD },
- { "METHOD_POST", HTTP_METHOD_POST },
- { "METHOD_DELETE", HTTP_METHOD_DELETE },
- { "METHOD_OPTIONS", HTTP_METHOD_OPTIONS },
- { "METHOD_PATCH", HTTP_METHOD_PATCH },
+ { "HTTP_METHOD_GET", HTTP_METHOD_GET },
+ { "HTTP_METHOD_PUT", HTTP_METHOD_PUT },
+ { "HTTP_METHOD_HEAD", HTTP_METHOD_HEAD },
+ { "HTTP_METHOD_POST", HTTP_METHOD_POST },
+ { "HTTP_METHOD_DELETE", HTTP_METHOD_DELETE },
+ { "HTTP_METHOD_OPTIONS", HTTP_METHOD_OPTIONS },
+ { "HTTP_METHOD_PATCH", HTTP_METHOD_PATCH },
{ "WEBSOCKET_OP_TEXT", WEBSOCKET_OP_TEXT },
{ "WEBSOCKET_OP_BINARY", WEBSOCKET_OP_BINARY },
{ "WEBSOCKET_BROADCAST_LOCAL", WEBSOCKET_BROADCAST_LOCAL },