<commit_before>package Mojolicious::Controller;

use strict;
use warnings;

use base 'MojoX::Dispatcher::Routes::Controller';

use Mojo::ByteStream;
use Mojo::Exception;
use Mojo::URL;

require Carp;

# Space: It seems to go on and on forever...
# but then you get to the end and a gorilla starts throwing barrels at you.
sub client { shift->app->client }

sub finish {
    my $self = shift;

    # Transaction
    my $tx = $self->tx;

    # Finish WebSocket
    return $tx->finish if $tx->is_websocket;

    # Render
    $self->app->routes->auto_render($self);

    # Finish
    $self->app->finish($self);

    # Resume
    $self->resume if $tx->is_paused;
}

sub finished {
    my ($self, $cb) = @_;

    # Transaction finished
    $self->tx->finished(sub { shift and $self->$cb(@_) });
}

sub helper {
    my $self = shift;

    # Name
    return unless my $name = shift;

    # Helper
    Carp::croak(qq/Helper "$name" not found/)
      unless my $helper = $self->app->renderer->helper->{$name};

    # Run
    return $self->$helper(@_);
}

sub pause { shift->tx->pause }

sub receive_message {
    my $self = shift;

    # Deactivate auto rendering
    $self->stash->{'mojo.rendered'} = 1;

    # WebSocket check
    Carp::croak('No WebSocket connection to receive messages from')
      unless $self->tx->is_websocket;

    # Callback
    my $cb = shift;

    # Receive
    $self->tx->receive_message(sub { shift and $self->$cb(@_) });

    return $self;
}

sub redirect_to {
    my $self = shift;

    # Rendered
    $self->stash->{'mojo.rendered'} = 1;

    # Code
    $self->res->code(302);

    # Location header
    $self->res->headers->location($self->url_for(@_)->to_abs);

    return $self;
}<commit_msg>fix for quirky browser behavior<commit_after>package Mojolicious::Controller;

use strict;
use warnings;

use base 'MojoX::Dispatcher::Routes::Controller';

use Mojo::ByteStream;
use Mojo::Exception;
use Mojo::URL;

require Carp;

# Space: It seems to go on and on forever...
# but then you get to the end and a gorilla starts throwing barrels at you.
sub client { shift->app->client }

sub finish {
    my $self = shift;

    # Transaction
    my $tx = $self->tx;

    # Finish WebSocket
    return $tx->finish if $tx->is_websocket;

    # Render
    $self->app->routes->auto_render($self);

    # Finish
    $self->app->finish($self);

    # Resume
    $self->resume if $tx->is_paused;
}

sub finished {
    my ($self, $cb) = @_;

    # Transaction finished
    $self->tx->finished(sub { shift and $self->$cb(@_) });
}

sub helper {
    my $self = shift;

    # Name
    return unless my $name = shift;

    # Helper
    Carp::croak(qq/Helper "$name" not found/)
      unless my $helper = $self->app->renderer->helper->{$name};

    # Run
    return $self->$helper(@_);
}

sub pause { shift->tx->pause }

sub receive_message {
    my $self = shift;

    # Deactivate auto rendering
    $self->stash->{'mojo.rendered'} = 1;

    # WebSocket check
    Carp::croak('No WebSocket connection to receive messages from')
      unless $self->tx->is_websocket;

    # Callback
    my $cb = shift;

    # Receive
    $self->tx->receive_message(sub { shift and $self->$cb(@_) });

    return $self;
}

sub redirect_to {
    my $self = shift;

    # Rendered
    $self->stash->{'mojo.rendered'} = 1;

    # Response
    my $res = $self->res;

    # Code
    $res->code(302);

    # Headers
    my $headers = $res->headers;
    $headers->location($self->url_for(@_)->to_abs);
    $headers->content_length(0);

    return $self;
}
{'fraction_non_alphanumeric': 0.15643564356435644, 'fraction_numerical': 0.0031117397454031117, 'mean_word_length': 2.8687089715536107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 79, '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': '5975683', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1187, 'n_words': 313}