<commit_before>library SimpleServer;

import 'dart:async';
import 'dart:io';
import 'package:SimpleServer/SimpleServer.dart';
import 'package:route_provider/route_provider.dart';

class RouteControllerError extends RouteController {
    RouteControllerError();

    Future<Map> execute(HttpRequest request, Map params) async  {
        throw new RouteError(HttpStatus.NOT_FOUND,"ERROR");
    }
}

class APIController extends RestApiController {
    Future<Map> onGet(HttpRequest request, Map params) async {
        throw new RouteError(HttpStatus.INTERNAL_SERVER_ERROR, 'Not supported');
    }
}

class ExitController extends RestApiController {
    SimpleServer server;

    ExitController(this.server);

    Future<Map> onGet(HttpRequest request, Map params) async {
        this.server.stop();
        return new Map();
    }
}

Future main() async {

    //start webserver
    SimpleServer server = new SimpleServer("/", "/docroot");
    bool serverStarted = await server.start();

    if (serverStarted == true) {
        server.route(
            // url: "/",
            // controller: new EmptyRouteController(),
            responser: new FileResponse("docroot/home.html")
        )
        ..route(
            url: "/error",
            controller: new RouteControllerError(),
            responser: new FileResponse("docroot/home.html")
        )
        ..route(
            url: "/error2",
            controller: new APIController(),
            responser: new FileResponse("docroot/home.html")
        )
        ..route(
            url: "/exit",
            controller: new ExitController(server),
            responser: new FileResponse("docroot/home.html")
        )
        ..go();

        //perform more tests here

        //close server
        //server.stop();
    }
}<commit_msg>reformat<commit_after>library SimpleServer;

import 'dart:async';
import 'dart:io';
import 'package:SimpleServer/SimpleServer.dart';
import 'package:route_provider/route_provider.dart';

class RouteControllerError extends RouteController {
    RouteControllerError();

    Future<Map> execute(HttpRequest request, Map params) async  {
        throw new RouteError(HttpStatus.NOT_FOUND,"ERROR");
    }
}

class APIController extends RestApiController {
    Future<Map> onGet(HttpRequest request, Map params) async {
        throw new RouteError(HttpStatus.INTERNAL_SERVER_ERROR, 'Not supported');
    }
}

class ExitController extends RestApiController {
    SimpleServer server;

    ExitController(this.server);

    Future<Map> onGet(HttpRequest request, Map params) async {
        this.server.stop();
        return new Map();
    }
}

Future main() async {

    //start webserver
    SimpleServer server = new SimpleServer("/", "/docroot");
    bool serverStarted = await server.start();

    if (serverStarted == true) {
        server.route(
            // url: "/",
            // controller: new EmptyRouteController(),
            responser: new FileResponse("docroot/home.html")
        )
        ..route(
            url: "/error",
            controller: new RouteControllerError(),
            responser: new FileResponse("docroot/home.html")
        )
        ..route(
            url: "/error2",
            controller: new APIController(),
            responser: new FileResponse("docroot/home.html")
        )
        ..route(
            url: "/exit",
            controller: new ExitController(server),
            responser: new FileResponse("docroot/home.html")
        )
        ..go();

        //perform more tests here

        //close server
        server.stop();
    }
}
{'fraction_non_alphanumeric': 0.11428571428571428, 'fraction_numerical': 0.0005547850208044383, 'mean_word_length': 2.4180094786729858, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '1434700', 'n_tokens_mistral': 971, 'n_tokens_neox': 955, 'n_words': 232}