forked from cory/tildefriends
Treat the ?query string and body the same as httpd.js does. Now I can auth.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4691 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -102,6 +102,7 @@ static void _httpd_callback(tf_http_request_t* request)
|
||||
http_handler_data_t* data = request->user_data;
|
||||
JSContext* context = data->context;
|
||||
JSValue request_object = JS_NewObject(context);
|
||||
JS_SetPropertyStr(context, request_object, "method", JS_NewString(context, request->method));
|
||||
JS_SetPropertyStr(context, request_object, "uri", JS_NewString(context, request->path));
|
||||
JSValue headers = JS_NewObject(context);
|
||||
for (int i = 0; i < request->headers_count; i++)
|
||||
@ -109,6 +110,14 @@ static void _httpd_callback(tf_http_request_t* request)
|
||||
JS_SetPropertyStr(context, headers, request->headers[i].name, JS_NewString(context, request->headers[i].value));
|
||||
}
|
||||
JS_SetPropertyStr(context, request_object, "headers", headers);
|
||||
if (request->query)
|
||||
{
|
||||
JS_SetPropertyStr(context, request_object, "query", JS_NewString(context, request->query));
|
||||
}
|
||||
if (request->body)
|
||||
{
|
||||
JS_SetPropertyStr(context, request_object, "body", tf_util_new_uint8_array(context, request->body, request->content_length));
|
||||
}
|
||||
|
||||
JSValue client = JS_NewObject(context);
|
||||
JS_SetPropertyStr(context, client, "tls", JS_FALSE);
|
||||
|
Reference in New Issue
Block a user