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));
my $reason = $resp->{reason} // '';
my $message = "HTTP transport returned $resp->{status} ($reason): $content";
+ chomp $message;
+
return {
error => $message,
response => $data,
authorization => 'Bearer s3cr3t',
},
};
- my $response = $client->execute($request, $options);
+ my $response = $transport->execute($request, $options);
=head1 DESCRIPTION
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
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
},
}