FlyingFox icon indicating copy to clipboard operation
FlyingFox copied to clipboard

Abilities to insert or delete the handlers in RoutedHTTPHandler

Open timyeou1234 opened this issue 1 year ago • 0 comments

We currently only support for

public mutating func appendRoute(_ route: HTTPRoute, to handler: HTTPHandler) {
        handlers.append((route, handler))
    }
    public mutating func appendRoute(_ route: HTTPRoute,
                                     handler: @Sendable @escaping (HTTPRequest) async throws -> HTTPResponse) {
        handlers.append((route, ClosureHTTPHandler(handler)))
    }

Can we also have the function that inserts at 0 or remove all handlers. The scenario we encounter is that we use it on the UI test, while we need to mock a response change, we will need to change the handlers array to make it happen, if append is the only function, we will need to rebuild a server again to make the change.

timyeou1234 avatar Jan 31 '24 07:01 timyeou1234