dom*_*omp 15 ruby-on-rails elixir phoenix-framework
我想返回一个没有内容(只是标题)的响应,就像这个一样
def show
head :ok
end
Run Code Online (Sandbox Code Playgroud)
Dog*_*ert 25
您可以将Plug.Conn.send_resp/3与空体一起使用:
# 200 OK
send_resp(conn, 200, "")
send_resp(conn, :ok, "") # same as above
# 401 Unauthorized
send_resp(conn, 401, "")
send_resp(conn, :unauthorized, "") # same as above
Run Code Online (Sandbox Code Playgroud)
send_resp可以将状态(第二个参数)作为整数或此处提到的受支持原子之一:https://hexdocs.pm/plug/Plug.Conn.Status.html#code/1.
| 归档时间: |
|
| 查看次数: |
3136 次 |
| 最近记录: |