Skip to content

Commit

Permalink
Merge pull request Clouda-team#77 from imyelo/master
Browse files Browse the repository at this point in the history
fix bug: fetch第三方数据时发送整个json对象的post请求
  • Loading branch information
tongyao committed Jan 24, 2014
2 parents d09438d + 4a8a647 commit 2f98871
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sumeru/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ var runnable = function(fw){
redirect:function(queryPath,paramMap,isforce){
var urlHash = queryPath;
if(paramMap){
urlHash += "!" + fw.utils.mapToUriParam(paramMap);
urlHash += "?" + fw.utils.mapToUriParam(paramMap);
}
fw.router.redirect(urlHash,isforce);
},
Expand Down
26 changes: 19 additions & 7 deletions sumeru/src/external.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,27 @@ var runnable = function(fw, findDiff, publishBaseDir, externalConfig, http, http
*/
function sendPostRequest(options, postData, cb, buffer){
//server
var defaultOptions;
if(fw.IS_SUMERU_SERVER){
postData = encodeURIComponent(JSON.stringify(postData));
var defaultOptions = {
method : 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': postData.length
if (options && options.json === true) {
postData = JSON.stringify(postData);
defaultOptions = {
method : 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': postData.length
}
};
};
} else {
postData = encodeURIComponent(JSON.stringify(postData));
defaultOptions = {
method : 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': postData.length
}
};
}

var opts = Library.objUtils.extend(true, defaultOptions, options);

Expand Down

0 comments on commit 2f98871

Please sign in to comment.