Commit 3ab04de8 authored by Krit Punpreuk's avatar Krit Punpreuk

Update perform.js

parent 43820025
...@@ -56,7 +56,8 @@ function perform_function(context,request,response){ ...@@ -56,7 +56,8 @@ function perform_function(context,request,response){
// Setup Body if POST or PUT // Setup Body if POST or PUT
if(method == 'POST' || method == 'PUT') { if(method == 'POST' || method == 'PUT') {
if(option.headers['content-type'] && option.headers['content-type'] == 'application/json') { if(option.headers['content-type'] && option.headers['content-type'] == 'application/json') {
option.body = JSON.parse(body.replace(/\n/g, "\\\\n")) option.body = JSON.parse(body.replace(/\n/g, "\\n"))
option.json = true
} else { } else {
option.body = body option.body = body
} }
...@@ -80,7 +81,7 @@ function send_request(option,cb){ ...@@ -80,7 +81,7 @@ function send_request(option,cb){
cb(new Error("send error")); cb(new Error("send error"));
} }
}else{ }else{
cb(error) cb(new Error("error"))
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment