Both should return a text and not a json object to make it dynamicly
This commit is contained in:
parent
d3e0833913
commit
7f5d48551d
@ -16,7 +16,7 @@
|
|||||||
func requestToRequestDict(requestUUID: String, request: GCDWebServerDataRequest) -> Dictionary<String, Any> {
|
func requestToRequestDict(requestUUID: String, request: GCDWebServerDataRequest) -> Dictionary<String, Any> {
|
||||||
return [
|
return [
|
||||||
"requestId": requestUUID,
|
"requestId": requestUUID,
|
||||||
"body": request.jsonObject ?? "",
|
"body": request.text ?? "",
|
||||||
"headers": request.headers,
|
"headers": request.headers,
|
||||||
"method": request.method,
|
"method": request.method,
|
||||||
"path": request.url.path,
|
"path": request.url.path,
|
||||||
|
@ -38,16 +38,21 @@ exports.defineManualTests = function(contentEl, createActionButton) {
|
|||||||
webserver.onRequest(
|
webserver.onRequest(
|
||||||
function(request) {
|
function(request) {
|
||||||
console.log('Received request');
|
console.log('Received request');
|
||||||
console.log('Sending response');
|
console.log('requestId: ', request.requestId);
|
||||||
|
console.log('body: ', request.body);
|
||||||
|
console.log('headers: ', request.headers);
|
||||||
|
console.log('path: ', request.path);
|
||||||
|
console.log('query: ', request.query);
|
||||||
|
|
||||||
webserver.sendResponse(
|
webserver.sendResponse(
|
||||||
request["requestId"],
|
request.requestId,
|
||||||
{
|
{
|
||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'text/html',
|
||||||
'TestHeader': 'Just a testheader'
|
'TestHeader': 'Just a testheader'
|
||||||
},
|
},
|
||||||
body: '{"hello":"from js!"}'
|
body: '<html><form method="POST"><input type="text" name="bla" /><input type="submit" /></form></html>'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user