Fuzz 0.1.1

Fuzz 0.1.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2015
SPMSupports SPM

Maintained by Paulo Faria.



Fuzz 0.1.1

  • By
  • Paulo Faria

Fuzz

codecov.io

Fuzz is an HTTP middleware framework for Swift 2.

Features

  • [x] No Foundation dependency (Linux ready)
  • [x] HTTP Request Middleware
  • [x] HTTP Response Middleware

Usage

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)

Installation

Command Line Application

To use Fuzz in a command line application:

License

Fuzz is released under the MIT license. See LICENSE for details.