|
|
@@ -124,26 +124,19 @@ status: Robot cars invade California, on orders from Google: Google has been tes
|
|
|
go为所有的HTTP状态码定义了常量,比如:
|
|
|
|
|
|
http.StatusContinue = 100
|
|
|
-
|
|
|
http.StatusOK = 200
|
|
|
-
|
|
|
http.StatusFound = 302
|
|
|
-
|
|
|
http.StatusBadRequest = 400
|
|
|
-
|
|
|
http.StatusUnauthorized = 401
|
|
|
-
|
|
|
http.StatusForbidden = 403
|
|
|
-
|
|
|
http.StatusNotFound = 404
|
|
|
-
|
|
|
http.StatusInternalServerError = 500
|
|
|
|
|
|
你可以使用`w.header().Set("Content-Type", "../..")设置头信息
|
|
|
|
|
|
比如在网页应用发送html字符串的时候,在输出之前执行`w.Header().Set("Content-Type", "text/html")`。
|
|
|
|
|
|
-练习 15.4:扩展 http_fetch.go 使之可以从控制台读取url,使用[章节12.1](12.1.md)学到的接收控制台输入的方法 [http_fetch2.go](examples/chapter_15/http_fetch2.go)
|
|
|
+练习 15.4:扩展 http_fetch.go 使之可以从控制台读取url,使用[章节12.1](12.1.md)学到的接收控制台输入的方法 ([http_fetch2.go](examples/chapter_15/http_fetch2.go))
|
|
|
|
|
|
练习 15.5:获取json格式的推特状态,就像示例 15.9([twitter_status_json.go](examples/chapter_15/twitter_status_json.go))
|
|
|
|