元編程參考文件

響應

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
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
響應
所屬包
網路應用