{"size": 803, "ext": "scrbl", "max_stars_repo_path": "post/2020-11-20-riposte.scrbl", "max_stars_repo_name": "SmallFont00/racket-tw.github.io", "max_stars_repo_stars_event_min_datetime": "2020-06-21T15:07:58.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-21T15:07:58.000Z", "max_issues_repo_path": "post/2020-11-20-riposte.scrbl", "max_issues_repo_name": "SmallFont00/racket-tw.github.io", "max_issues_repo_issues_event_min_datetime": "2020-06-24T03:17:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-08T06:00:08.000Z", "max_forks_repo_path": "post/2020-11-20-riposte.scrbl", "max_forks_repo_name": "SmallFont00/racket-tw.github.io", "max_forks_repo_forks_event_min_datetime": "2021-05-21T12:17:27.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-22T08:03:44.000Z"}
{"max_stars_count": 1, "max_issues_count": 9, "max_forks_count": 2, "avg_line_length": 21.1315789474, "max_line_length": 111, "alphanum_fraction": 0.7322540473}
#lang scribble/manual
@(require (for-label racket))

@title{Riposte}
@author[(author+email "Lîm Tsú-thuàn" "dannypsnl@gmail.com")]

Riposte 可以像 postman 一樣幫助我們建立可以反覆測試的 HTTP Request，但寫出來的腳本可以提交進 repository 的同時又不需要依賴 postman 這樣的操作介面。可以通過下面的指令安裝：

@codeblock|{
raco pkg install riposte
}|

使用時是建立副檔名為 @code{rip} 的程式

@codeblock|{
#lang riposte

^Content-Type := "application/json"
^Cache-Control := "no-cache"
%base := https://api.examplebookstore.com:8888/
%timeout := 30

$id := @ID with fallback "1234567890"
GET book/{id} responds with 2XX
}|

這是發送 @bold{GET} 的範例，我們也可以把一些常用的程式拆分出去：

@codeblock|{
;;; headers.rip
#lang riposte

^Content-Type := "application/json"
^Cache-Control := "no-cache"
}|

然後用 @code{import headers.rip} 引用。更多資訊可以直接去看 @link["Riposte 的文件" "https://docs.racket-lang.org/riposte/"]
