快速開始
本頁說明安裝 go-rest-client 並送出第一個請求所需的步驟。
前置需求
| 項目 | 需求 |
|---|---|
| Go | 1.25.1 以上(go.mod 宣告版本;僅原始碼建置與 go install 需要) |
| 終端機 | 支援 256 色,由 tcell 負責繪製 |
| 網路 | 可連線至 .http 檔中的目標 API |
安裝
從原始碼建置
git clone https://github.com/pardnchiu/go-rest-client.git
cd go-rest-client
go build -o gorc ./cmd/tui
sudo cp gorc /usr/local/bin/gorc
使用 go install
go install github.com/pardnchiu/go-rest-client/cmd/tui@latest
sudo cp "$(go env GOPATH)/bin/tui" /usr/local/bin/gorc
go install 依 package 目錄命名執行檔為 tui;複製為 gorc 只是為了好記,本站其餘頁面皆以 gorc 稱呼。
第一次執行
建立 api.http:
### Get User Info
GET https://api.github.com/users/pardnchiu
Accept: application/json
###
啟動:
gorc api.http
左欄出現「Get User Info」,右欄預覽請求行與 Header。按 Enter 送出,右欄改為顯示狀態碼、回應 Header、耗時與格式化後的 JSON Body;按 Esc 或 Ctrl+C 離開。
下一步
- 撰寫更多請求:.http 檔案格式
- 熟悉操作:鍵盤操作
- 邊改邊測:存檔即時重載