Nest Web Server Gateway Interface的实用工具集合。提供RequestType
和ResponseType
实现。
Inquiline提供了一个RequestType
实现。
let request = Request(method: "GET", path: "/", headers: nil, body: nil)
Inquiline扩展了RequestType,提供了便利的头标索引和头标访问器。
request["Content-Type"]
request.host
request.contentType
request.contentLength
request.accept
request.authorization
request.cacheControl
Inquiline提供了一个ResponseType
实现。
let response = Response(.Ok, contentType: "plain/text", body: "Hello World")
HTTP/1.1 200 OK
Content-Type: plain/text
Content-Length: 11
Hello World
response["Cache-Control"] = "no-cache"
response.contentType = "application/json"
response.cacheControl = "no-cache"
pod 'Inquiline'
Inquiline采用BSD许可证发布。参见LICENSE。