Fuzz 0.1.1

Fuzz 0.1.1

测试测试过的
Lang语言 SwiftSwift
许可 MIT
发布上次发布2015年11月
SPM支持SPM

Paulo Faria维护。



Fuzz 0.1.1

  • 作者
  • Paulo Faria

Fuzz

codecov.io

Fuzz 是一个针对 Swift 2 的 HTTP 中间件框架。

特性

  • [x] 无 Foundation 依赖(Linux兼容
  • [x] HTTP 请求中间件
  • [x] HTTP 响应中间件

使用

struct Middleware : HTTPRequestMiddlewareType {
    func respond(request: HTTPRequest) -> HTTPRequestMiddlewareResult {
        // You can change the request and pass it forward
        return .Next(request)

        // Or you can respond early and bypass the chain
        return .Respond(HTTPResponse(statusCode: 404, reasonPhrase: "Not Found"))
    }
}

struct Responder : HTTPResponderType {
    func respond(request: HTTPRequest) -> HTTPResponse {
        // May or may not be called
        return HTTPResponse(statusCode: 200, reasonPhrase: "OK")
    }
}

let request = HTTPRequest(method: .GET, uri: URI(path: "/"))
let chain = Middleware() >>> Responder()
let response = chain.respond(request)

安装

命令行应用程序

要在命令行应用程序中使用 Fuzz

许可

Fuzz 采用 MIT 许可发布。有关详细信息,请参阅 LICENSE 文件。