mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
update
This commit is contained in:
parent
ead29d4687
commit
8f4cd7ea8a
@ -7,16 +7,24 @@ var fs = require('fs');
|
||||
var path = require('path');
|
||||
var url = require('url');
|
||||
var comparison = require('./Comparison.js');
|
||||
var utils = require('thinkjs-util');
|
||||
|
||||
var escapeComparison = function(value) {
|
||||
if(!Array.isArray(value)) {
|
||||
return value;
|
||||
if(Array.isArray(value) && typeof value[0] === 'string') {
|
||||
if(comparison.COMPARISON_LIST.indexOf(value[0].toUpperCase()) > -1) {
|
||||
value[0] += ' ';
|
||||
}
|
||||
}
|
||||
if(typeof value[0] !== 'string') {
|
||||
return value[0];
|
||||
}
|
||||
if(comparison.COMPARISON_LIST.indexOf(value[0].toUpperCase()) > -1) {
|
||||
value[0] += ' ';
|
||||
if(utils.isObject(value)) {
|
||||
var result = {};
|
||||
for(var key in value) {
|
||||
if(comparison.COMPARISON_LIST.indexOf(key.toUpperCase()) > -1) {
|
||||
result[key + ' '] = value[key];
|
||||
}else{
|
||||
result[key] = value[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -255,6 +255,47 @@ describe('Controller', function(){
|
||||
})
|
||||
})
|
||||
|
||||
it('instance.post("xxx") 2', function(done){
|
||||
promise.then(function(instance){
|
||||
//console.log(JSON.stringify(instance.get()));
|
||||
instance.http.post.key222 = ['EXP ', 2];
|
||||
assert.deepEqual(instance.post('key222'), ['EXP ', 2]);
|
||||
delete instance.http.post.key222;
|
||||
done();
|
||||
})
|
||||
})
|
||||
it('instance.post("xxx") 3', function(done){
|
||||
promise.then(function(instance){
|
||||
//console.log(JSON.stringify(instance.get()));
|
||||
instance.http.post.key333 = {EXP: 3}
|
||||
assert.deepEqual(instance.post('key333'), {'EXP ': 3});
|
||||
delete instance.http.post.key333;
|
||||
done();
|
||||
})
|
||||
})
|
||||
|
||||
it('instance.post("xxx") 4', function(done){
|
||||
promise.then(function(instance){
|
||||
//console.log(JSON.stringify(instance.get()));
|
||||
instance.http.post.key333 = {EXP3: 3}
|
||||
assert.deepEqual(instance.post('key333'), {'EXP3': 3});
|
||||
delete instance.http.post.key333;
|
||||
done();
|
||||
})
|
||||
})
|
||||
|
||||
it('instance.post("xxx") 5', function(done){
|
||||
promise.then(function(instance){
|
||||
//console.log(JSON.stringify(instance.get()));
|
||||
instance.http.post.key222 = ['EXP2', 2];
|
||||
assert.deepEqual(instance.post('key222'), ['EXP2', 2]);
|
||||
delete instance.http.post.key222;
|
||||
done();
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
it('instance.param()', function(done){
|
||||
promise.then(function(instance){
|
||||
//console.log(instance.param())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user