<commit_before>import HTTP

extension Responder {
    @discardableResult
    public func testResponse(
        to method: HTTP.Method,
        at path: String,
        hostname: String = "0.0.0.0",
        headers: [HeaderKey: String] = [:],
        body: BodyRepresentable? = nil,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let req = Request.makeTest(
            method: .get,
            headers: headers,
            body: body?.makeBody() ?? .data([]),
            hostname: hostname,
            path: path
        )
        return try testResponse(
            to: req,
            file: file,
            line: line
        )
    }

    @discardableResult
    public func testResponse(
        to req: Request,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let res: Response

        do {
            res = try respond(to: req)
        } catch {
            onFail(
                "Failed to create response: \(error)",<commit_msg>fixes #1000<commit_after>import HTTP

extension Responder {
    @discardableResult
    public func testResponse(
        to method: HTTP.Method,
        at path: String,
        hostname: String = "0.0.0.0",
        headers: [HeaderKey: String] = [:],
        body: BodyRepresentable? = nil,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let req = Request.makeTest(
            method: .get,
            headers: headers,
            body: body?.makeBody() ?? .data([]),
            hostname: hostname,
            path: path
        )
        req.headers[.host] = hostname
        return try testResponse(
            to: req,
            file: file,
            line: line
        )
    }

    @discardableResult
    public func testResponse(
        to req: Request,
        file: StaticString = #file,
        line: UInt = #line
    ) throws -> Response {
        let res: Response

        do {
            res = try respond(to: req)
        } catch {
            onFail(
                "Failed to create response: \(error)",
{'fraction_non_alphanumeric': 0.10328638497652583, 'fraction_numerical': 0.005633802816901409, 'mean_word_length': 1.4865810968494748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5300870', 'n_tokens_mistral': 603, 'n_tokens_neox': 585, 'n_words': 170}