为什么webserver的返回不能放在channel中统一返回

zhaohao · · 2788 次点击
type Handler A Handler responds to an HTTP request. ServeHTTP should write reply headers and data to the ResponseWriter and then return. Returning signals that the request is finished; it is not valid to use the ResponseWriter or read from the Request.Body after or concurrently with the completion of the ServeHTTP call.
#3
更多评论
不太明白你的出错点在哪?
#1
这个代码改成异步的了。 但是用postman请求时,第一个返回时对的,之后就变成框架默认返回了,不是c.JSON(http.StatusOK, name) 返回的了
#2