Fix syntax marker in hint line
Change-Id: I554720eadddc949495d3c255aa76e4204de9845a
diff --git a/lib/Kalamar/API.pm b/lib/Kalamar/API.pm
index 60e04db..c8f9d25 100644
--- a/lib/Kalamar/API.pm
+++ b/lib/Kalamar/API.pm
@@ -398,6 +398,19 @@
my ($self, $type, $index, $tx) = @_;
my $c = $index->controller;
+ my $json;
+ my $res = $tx->res;
+
+ # Json failure
+ unless ($json = $res->json) {
+ $c->notify(error => 'JSON response is invalid');
+ $index->status(0);
+ return;
+ };
+
+ # Set api response as jsonld
+ $index->api_response($json);
+
# An error has occurded
if (my $e = $tx->error) {
@@ -413,19 +426,9 @@
return;
};
+
# Response was fine
- if (my $res = $tx->success) {
-
- # Json failure
- my $json;
- unless ($json = $res->json) {
- $c->notify(error => 'JSON response is invalid');
- $index->status(0);
- return;
- };
-
- # Set api response as jsonld
- $index->api_response($json);
+ if ($res->is_success) {
# expected response for matches
if ($type eq 'matches') {
diff --git a/t/remote.t b/t/remote.t
index e86783e..ec38696 100644
--- a/t/remote.t
+++ b/t/remote.t
@@ -7,6 +7,8 @@
my $t = Test::Mojo->new('Kalamar');
+if (0) {
+
$t->get_ok('/')
->status_is(200)
->text_is('title', 'KorAP - Corpus Analysis Platform')
@@ -54,11 +56,14 @@
->text_is('.notify-error', '500: Internal Server Error (remote)')
;
+};
+
# Check for query error
$t->get_ok('/?q=[orth=das&ql=poliqarp')
->element_exists('.notify-error')
->text_is('.notify-error', '302: Parantheses/brackets unbalanced.')
+ ->content_like(qr!KorAP\.koralQuery =!)
;
done_testing;