我想知道如何为我的 REST 调用压缩返回 JSON:
GET /orders HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
但是文档只谈论返回文件
let setJson it =
it
|>JsonUtils.toJson
|> OK
>=> setMimeType "application/json; charset=utf-8"
let doReq route request action =
path route >=> setCORSHeaders >=> request (fun r -> action(r) |> setJson)
doReq "/orders" request (fun r -> queryOrders(r |> getTerm, Products.Name))