Skip to content

Commit

Permalink
Don't write query params yourself.
Browse files Browse the repository at this point in the history
  • Loading branch information
oalders committed Apr 24, 2016
1 parent aeaed23 commit afed642
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/MetaCPAN/Web/Model/API.pm
Expand Up @@ -12,6 +12,7 @@ use JSON::MaybeXS;
use MetaCPAN::Web::Types qw( Uri );
use MooseX::ClassAttribute;
use Try::Tiny qw( catch try );
use URI::QueryParam;

class_has client => (
is => 'ro',
Expand Down Expand Up @@ -63,9 +64,10 @@ sub request {
my ( $self, $path, $search, $params ) = @_;

my ( $token, $method ) = @$params{qw(token method)};
$path .= "?access_token=$token" if ($token);
my $req = $self->cv;

my $url = $self->api_secure->clone;
$url->query_param( access_token => $token ) if $token;
$url->path($path);

my $request = HTTP::Request->new(
Expand Down Expand Up @@ -191,5 +193,4 @@ sub raw_api_response {
}

__PACKAGE__->meta->make_immutable;

1;

0 comments on commit afed642

Please sign in to comment.