summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit11
1 files changed, 9 insertions, 2 deletions
diff --git a/dgit b/dgit
index cde8546..80adf1f 100755
--- a/dgit
+++ b/dgit
@@ -1223,8 +1223,7 @@ sub archive_api_query_cmd ($) {
return @cmd;
}
-sub api_query ($$;$) {
- use JSON;
+sub api_query_raw ($$;$) {
my ($data, $subpath, $ok404) = @_;
badcfg __ "ftpmasterapi archive query method takes no data part"
if length $data;
@@ -1240,6 +1239,14 @@ sub api_query ($$;$) {
return undef if $code eq '404' && $ok404;
fail f_ "fetch of %s gave HTTP code %s", $url, $code
unless $url =~ m#^file://# or $code =~ m/^2/;
+ return $json;
+}
+
+sub api_query ($$;$) {
+ my ($data, $subpath, $ok404) = @_;
+ use JSON;
+ my $json = api_query_raw $data, $subpath, $ok404;
+ return undef unless defined $json;
return decode_json($json);
}