Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
no need for default values
  • Loading branch information
kraih committed Jan 12, 2016
1 parent 27af4e7 commit bffb5e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.40 2016-01-12
6.40 2016-01-13
- Removed client_challenge, client_handshake, server_handshake and server_open
methods from Mojo::Transaction::WebSocket. (batman, sri)
- Removed is_writing method from Mojo::Transaction.
Expand Down
7 changes: 2 additions & 5 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -5,13 +5,11 @@ use Compress::Raw::Zlib 'Z_SYNC_FLUSH';
use Config;
use List::Util 'first';
use Mojo::JSON qw(encode_json j);
use Mojo::Transaction::HTTP;
use Mojo::Util qw(decode deprecated encode trim);
use Mojo::WebSocket
qw(WS_BINARY WS_CLOSE WS_CONTINUATION WS_PING WS_PONG WS_TEXT);

has [qw(compressed established masked)];
has handshake => sub { Mojo::Transaction::HTTP->new };
has [qw(compressed established handshake masked)];
has max_websocket_size => sub { $ENV{MOJO_MAX_WEBSOCKET_SIZE} || 262144 };

# DEPRECATED in Clinking Beer Mugs!
Expand Down Expand Up @@ -362,8 +360,7 @@ WebSocket connection established.
my $handshake = $ws->handshake;
$ws = $ws->handshake(Mojo::Transaction::HTTP->new);
The original handshake transaction, defaults to a L<Mojo::Transaction::HTTP>
object.
The original handshake transaction, usually a L<Mojo::Transaction::HTTP> object.
=head2 masked
Expand Down
9 changes: 2 additions & 7 deletions lib/Mojo/Upload.pm
@@ -1,12 +1,7 @@
package Mojo::Upload;
use Mojo::Base -base;

use Mojo::Asset::File;
use Mojo::Headers;

has asset => sub { Mojo::Asset::File->new };
has [qw(filename name)];
has headers => sub { Mojo::Headers->new };
has [qw(asset filename headers name)];

sub move_to { $_[0]->asset->move_to($_[1]) and return $_[0] }

Expand Down Expand Up @@ -57,7 +52,7 @@ Name of the uploaded file.
my $headers = $upload->headers;
$upload = $upload->headers(Mojo::Headers->new);
Headers for upload, defaults to a L<Mojo::Headers> object.
Headers for upload, usually a L<Mojo::Headers> object.
=head2 name
Expand Down
11 changes: 9 additions & 2 deletions t/mojolicious/validation_lite_app.t
Expand Up @@ -3,6 +3,7 @@ use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }

use Test::More;
use Mojo::Asset::Memory;
use Mojo::Upload;
use Mojolicious::Lite;
use Test::Mojo;
Expand Down Expand Up @@ -143,8 +144,14 @@ is_deeply $validation->failed, ['baz'], 'right names';
# Upload size
$validation = $t->app->validation->input(
{
foo => [Mojo::Upload->new->tap(sub { $_->asset->add_chunk('valid') })],
bar => [Mojo::Upload->new->tap(sub { $_->asset->add_chunk('not valid') })]
foo => [
Mojo::Upload->new(asset => Mojo::Asset::Memory->new->add_chunk('valid'))
],
bar => [
Mojo::Upload->new(
asset => Mojo::Asset::Memory->new->add_chunk('not valid')
)
]
}
);
ok $validation->required('foo')->upload->size(1, 6)->is_valid, 'valid';
Expand Down

0 comments on commit bffb5e0

Please sign in to comment.