export http_body_path via python

This commit is contained in:
Joris Vink 2017-02-22 17:52:57 +01:00
parent 2f670ce777
commit c6ca68f3f2
2 changed files with 17 additions and 0 deletions

View File

@ -127,6 +127,7 @@ static PyObject *pyhttp_get_path(struct pyhttp_request *, void *);
static PyObject *pyhttp_get_body(struct pyhttp_request *, void *);
static PyObject *pyhttp_get_agent(struct pyhttp_request *, void *);
static PyObject *pyhttp_get_method(struct pyhttp_request *, void *);
static PyObject *pyhttp_get_body_path(struct pyhttp_request *, void *);
static PyObject *pyhttp_get_connection(struct pyhttp_request *, void *);
static PyGetSetDef pyhttp_request_getset[] = {
@ -135,6 +136,7 @@ static PyGetSetDef pyhttp_request_getset[] = {
GETTER("body", pyhttp_get_body),
GETTER("agent", pyhttp_get_agent),
GETTER("method", pyhttp_get_method),
GETTER("body_path", pyhttp_get_body_path),
GETTER("connection", pyhttp_get_connection),
GETTER(NULL, NULL)
};

View File

@ -1071,6 +1071,21 @@ pyhttp_get_method(struct pyhttp_request *pyreq, void *closure)
return (method);
}
static PyObject *
pyhttp_get_body_path(struct pyhttp_request *pyreq, void *closure)
{
PyObject *path;
if (pyreq->req->http_body_path == NULL) {
Py_RETURN_NONE;
}
if ((path = PyUnicode_FromString(pyreq->req->http_body_path)) == NULL)
return (PyErr_NoMemory());
return (path);
}
static PyObject *
pyhttp_get_connection(struct pyhttp_request *pyreq, void *closure)
{