用于服务管理的接口脚本,描述服务的响应对象。
usable range
服务管理-接口
syntax
var res = this.response;
methods
static
seeother(urlopt)
summary
服务返回一个303跳转。
syntax
this.response.seeother(url);
parameters
-
url
string
跳转的url。
source
static
redirect(urlopt)
summary
服务返回一个301跳转。
syntax
this.response.redirect(url);
parameters
-
url
string
跳转的url。
source
static
setbody(bodyopt, contenttypeopt)
summary
服务返回一个301跳转。
syntax
this.response.setbody(body, contenttype);
parameters
-
body
string
|object
响应内容,文本或json对象。
-
contenttype
string
响应头的content-type。
example
//设置json格式的响应内容
this.response.setbody({
"key1": "value1",
"key2": "value2"
}, "application/json");