元编程参考文档

响应

5 个节点

本页内容 5

HTML 响应

函数

A web page: the HTML as it is, sent as text/html. Values from a visitor go in through HTML Encode.

签名
HTML 响应(HTML: 文本, 状态码: 整数) -> EndpointResponse
EndpointResponse HtmlResponse(string html, int statusCode = 200)

参数

名称类型默认值说明
HTML文本—
状态码整数200

返回

响应EndpointResponse
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
响应
所属包
网络应用

JSON 响应

函数

A JSON answer: the text as it is, sent as application/json.

签名
JSON 响应(JSON: 文本, 状态码: 整数) -> EndpointResponse
EndpointResponse JsonResponse(string json, int statusCode = 200)

参数

名称类型默认值说明
JSON文本—The JSON - from a database result's To Json, a table's To JSON, or Format with JSON String for each value.
状态码整数200200 for an answer, 201 for something created, 400 for a request that was wrong, 404 for nothing there.

返回

响应EndpointResponse
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
响应
所属包
网络应用

重定向

函数

Sends the visitor's browser to another address - after a form is posted, to the page that shows the result (303, See Other).

签名
重定向(位置: 文本, 状态码: 整数) -> EndpointResponse
EndpointResponse Redirect(string location, int statusCode = 303)

参数

名称类型默认值说明
位置文本—Where to go: a path on this server (/entries) or a full address.
状态码整数303303 after a form post (the browser then asks with GET), 302 or 307 for a temporary move, 301 or 308 for a permanent one.

返回

响应EndpointResponse
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
响应
所属包
网络应用

文本响应

函数

A plain text answer.

签名
文本响应(文本: 文本, 状态码: 整数) -> EndpointResponse
EndpointResponse TextResponse(string text, int statusCode = 200)

参数

名称类型默认值说明
文本文本—
状态码整数200

返回

响应EndpointResponse
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
响应
所属包
网络应用

添加标头

函数

The same response with one more header - a Location, a Set-Cookie, a Cache-Control - replacing one of the same name.

签名
添加标头 -> EndpointResponse
    响应: EndpointResponse
    名称: 文本
    值: 文本
EndpointResponse WithHeader(
    EndpointResponse response,
    string name,
    string value)

参数

名称类型默认值说明
响应EndpointResponse—
名称文本—
值文本—

返回

响应EndpointResponse
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
响应
所属包
网络应用