]> Dogcows Code - chaz/graphql-client/blobdiff - lib/GraphQL/Client/http.pm
Version 0.605
[chaz/graphql-client] / lib / GraphQL / Client / http.pm
index a53228af1566b08312e0541fc4fa0a7d986d7daa..7c5fd7b412445fed4bd19cf3fdcf2bbf214ab4e0 100644 (file)
@@ -9,7 +9,7 @@ use HTTP::AnyUA::Util qw(www_form_urlencode);
 use HTTP::AnyUA;
 use namespace::clean;
 
-our $VERSION = '0.601'; # VERSION
+our $VERSION = '0.605'; # VERSION
 
 sub _croak { require Carp; goto &Carp::croak }
 
@@ -42,7 +42,7 @@ sub execute {
         my $encoded_data = $self->json->encode($data);
         $options->{content} = $encoded_data;
         $options->{headers}{'content-length'} = length $encoded_data;
-        $options->{headers}{'content-type'}   = 'application/json';
+        $options->{headers}{'content-type'}   = 'application/json;charset=UTF-8';
     }
 
     return $self->_handle_response($self->any_ua->request($method, $url, $options));
@@ -90,6 +90,8 @@ sub _handle_error {
     my $reason  = $resp->{reason}  // '';
     my $message = "HTTP transport returned $resp->{status} ($reason): $content";
 
+    chomp $message;
+
     return {
         error       => $message,
         response    => $data,
@@ -169,7 +171,7 @@ GraphQL::Client::http - GraphQL over HTTP
 
 =head1 VERSION
 
-version 0.601
+version 0.605
 
 =head1 SYNOPSIS
 
@@ -279,8 +281,8 @@ See L</ATTRIBUTES>.
 
 Get a response from the GraphQL server.
 
-The C<%data> structure must have a C<query> key whose value is the query or mutation string. It may
-optionally have a C<variables> hashref and an C<operationName> string.
+The C<%request> structure must have a C<query> key whose value is the query or mutation string. It
+may optionally have a C<variables> hashref and an C<operationName> string.
 
 The C<%options> structure is optional and may contain options passed through to the user agent. The
 only useful options are C<headers> (which should have a hashref value) and C<method> and C<url> to
@@ -294,7 +296,7 @@ such a hashref:
             data   => {...},
             errors => [...],
         },
-        error       => 'Something happened',    # may be ommitted if no error occurred
+        error       => 'Something happened',    # omitted if no error occurred
         details     => {    # optional information which may aide troubleshooting
         },
     }
@@ -314,7 +316,7 @@ feature.
 
 =head1 AUTHOR
 
-Charles McGarvey <chazmcgarvey@brokenzipper.com>
+Charles McGarvey <ccm@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
This page took 0.022825 seconds and 4 git commands to generate.