Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 12, 2013
1 parent 517b6f4 commit c70292e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Mojo/Message.pm
Expand Up @@ -21,14 +21,15 @@ sub body {
my $self = shift;

# Downgrade multipart content
$self->content(Mojo::Content::Single->new) if $self->content->is_multipart;
my $content = $self->content;
$content = $self->content(Mojo::Content::Single->new)->content
if $content->is_multipart;

# Get
return $content->asset->slurp unless defined(my $new = shift);
return $content->asset->slurp unless @_;

# Set raw content
$content->asset(Mojo::Asset::Memory->new->add_chunk($new));
$content->asset(Mojo::Asset::Memory->new->add_chunk(@_));

return $self;
}
Expand Down

0 comments on commit c70292e

Please sign in to comment.