Skip to content

Commit

Permalink
fixed: handle http method DELETE and fix lists tests to actually use …
Browse files Browse the repository at this point in the history
…::Lite!
  • Loading branch information
semifor committed May 14, 2010
1 parent 49b8e33 commit 4069cf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/net-twitter-lite.tt2
Expand Up @@ -363,13 +363,16 @@ sub _basic_authenticated_request {
_encode_args($args);

my $msg;
if ( $http_method eq 'GET' ) {
if ( $http_method =~ /^(?:GET|DELETE)$/ ) {
$uri->query_form($args);
$msg = GET($uri);
$msg = HTTP::Request->new($http_method, $uri);
}
elsif ( $http_method eq 'POST' ) {
$msg = $self->_mk_post_msg($uri, $args);
}
else {
croak "unexpected HTTP method: $http_method";
}

if ( $authenticate && $self->{username} && $self->{password} ) {
$msg->headers->authorization_basic(@{$self}{qw/username password/});
Expand Down
6 changes: 3 additions & 3 deletions t/60-api_lists.t
Expand Up @@ -2,17 +2,17 @@
use warnings;
use strict;
use Test::More;
use Net::Twitter;
use Net::Twitter::Lite;

eval 'use LWP::UserAgent 5.819';
plan skip_all => 'LWP::UserAgent 5.819 required' if $@;

my $nt = Net::Twitter->new(traits => [qw/API::Lists/], username => 'fred', password => 'secret');
my $nt = Net::Twitter::Lite->new(username => 'fred', password => 'secret');

my $req;
my $res = HTTP::Response->new(200);
$res->content('{"response":"done"}');
$nt->ua->add_handler(request_send => sub { $req = shift; return $res });
$nt->{ua}->add_handler(request_send => sub { $req = shift; return $res });

my @tests = (
create_list => {
Expand Down

0 comments on commit 4069cf6

Please sign in to comment.