X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FGraphQL%2FClient%2Fhttp.pm;fp=lib%2FGraphQL%2FClient%2Fhttp.pm;h=667e44ebc5ac2f8e0389078b1003c9d0159ff0d3;hb=794f74f42c89ba45a33f0c6c1461c769580aca8f;hp=a53228af1566b08312e0541fc4fa0a7d986d7daa;hpb=afe2bc3fe09e80cea209312408159ed83f1bfc91;p=chaz%2Fgraphql-client diff --git a/lib/GraphQL/Client/http.pm b/lib/GraphQL/Client/http.pm index a53228a..667e44e 100644 --- a/lib/GraphQL/Client/http.pm +++ b/lib/GraphQL/Client/http.pm @@ -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.602'; # VERSION sub _croak { require Carp; goto &Carp::croak } @@ -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.602 =head1 SYNOPSIS @@ -279,8 +281,8 @@ See L. Get a response from the GraphQL server. -The C<%data> structure must have a C key whose value is the query or mutation string. It may -optionally have a C hashref and an C string. +The C<%request> structure must have a C key whose value is the query or mutation string. It +may optionally have a C hashref and an C string. The C<%options> structure is optional and may contain options passed through to the user agent. The only useful options are C (which should have a hashref value) and C and C 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 }, }