<commit_before>export default class Controller {
    constructor(router, baseUrl = '') {
        this.router = router
        this.baseUrl = '/' + baseUrl.trimBoth('/')
    }

    get(relativeUrl, handler, name = null) {
        this.route('GET', this.url(relativeUrl), handler)
    }

    post(relativeUrl, handler, name = null) {
        this.route('POST', this.url(relativeUrl), handler)
    }

    delete(relativeUrl, handler, name = null) {
        this.route('DELETE', this.url(relativeUrl), handler)
    }

    patch(relativeUrl, handler, name = null) {
        this.route('PATCH', this.url(relativeUrl), handler)
    }

    put(relativeUrl, handler, name = null) {
        this.route('PUT', name, this.url(relativeUrl), handler)
    }

    route(method, path, handler, name = null) {
        var route = {
            method,
            path,
            config: {
                handler
            }
        }

        if (name)
            route.config.id = name

        this.router.route(route)
    }

    url(relativeUrl) {
        return this.baseUrl + ('/' + relativeUrl).trimBoth('/')
    }
}<commit_msg>Fix issue when generating URIs. Previous behavior removed URI-path separators, but did not properly concatenate with a base-value. This led to /path/to getting converted to /pathto.<commit_after>export default class Controller {
    constructor(router, baseUrl = '') {
        this.router = router
        this.baseUrl = '/' + baseUrl.trimBoth('/')
    }

    get(relativeUrl, handler, name = null) {
        this.route('GET', this.url(relativeUrl), handler)
    }

    post(relativeUrl, handler, name = null) {
        this.route('POST', this.url(relativeUrl), handler)
    }

    delete(relativeUrl, handler, name = null) {
        this.route('DELETE', this.url(relativeUrl), handler)
    }

    patch(relativeUrl, handler, name = null) {
        this.route('PATCH', this.url(relativeUrl), handler)
    }

    put(relativeUrl, handler, name = null) {
        this.route('PUT', name, this.url(relativeUrl), handler)
    }

    route(method, path, handler, name = null) {
        var route = {
            method,
            path,
            config: {
                handler
            }
        }

        if (name)
            route.config.id = name

        this.router.route(route)
    }

    url(relativeUrl) {
        return (this.baseUrl + '/' + relativeUrl).normalize('/');
    }
}
{'fraction_non_alphanumeric': 0.13327814569536423, 'fraction_numerical': 0.0, 'mean_word_length': 2.1066838046272496, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4486567', 'n_tokens_mistral': 721, 'n_tokens_neox': 693, 'n_words': 157}