mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-06 22:04:19 +00:00
Fix typo
This commit is contained in:
parent
d832bbcc70
commit
11ecaff7db
@ -24,7 +24,7 @@ exports.handler = function(request,response,state) {
|
|||||||
recipe_name_2 = $tw.utils.decodeURIComponentSafe(state.params[1]),
|
recipe_name_2 = $tw.utils.decodeURIComponentSafe(state.params[1]),
|
||||||
title = $tw.utils.decodeURIComponentSafe(state.params[2]),
|
title = $tw.utils.decodeURIComponentSafe(state.params[2]),
|
||||||
tiddlerInfo = recipe_name === recipe_name_2 && $tw.sqlTiddlerStore.getRecipeTiddler(title,recipe_name);
|
tiddlerInfo = recipe_name === recipe_name_2 && $tw.sqlTiddlerStore.getRecipeTiddler(title,recipe_name);
|
||||||
if(recipe_name === recipe_name_2 && tiddlerInfo) {
|
if(recipe_name === recipe_name_2 && tiddlerInfo && tiddlerInfo.tiddler) {
|
||||||
// If application/json is requested then this is an API request, and gets the response in JSON
|
// If application/json is requested then this is an API request, and gets the response in JSON
|
||||||
if(request.headers.accept && request.headers.accept.indexOf("application/json") !== -1) {
|
if(request.headers.accept && request.headers.accept.indexOf("application/json") !== -1) {
|
||||||
var tiddlerFields = {},
|
var tiddlerFields = {},
|
||||||
@ -45,11 +45,11 @@ exports.handler = function(request,response,state) {
|
|||||||
state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(tiddlerFields),"utf8");
|
state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(tiddlerFields),"utf8");
|
||||||
} else {
|
} else {
|
||||||
// This is not a JSON API request, we should return the raw tiddler content
|
// This is not a JSON API request, we should return the raw tiddler content
|
||||||
var type = tiddler.type || "text/plain";
|
var type = tiddlerInfo.tiddler.type || "text/plain";
|
||||||
response.writeHead(200, "OK",{
|
response.writeHead(200, "OK",{
|
||||||
"Content-Type": type
|
"Content-Type": type
|
||||||
});
|
});
|
||||||
response.write(tiddler.text || "",($tw.config.contentTypeInfo[type] ||{encoding: "utf8"}).encoding);
|
response.write(tiddlerInfo.tiddler.text || "",($tw.config.contentTypeInfo[type] ||{encoding: "utf8"}).encoding);
|
||||||
response.end();;
|
response.end();;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user