summary refs log tree commit diff
path: root/lib/jitterbug/WebService.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jitterbug/WebService.pm')
-rw-r--r--lib/jitterbug/WebService.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/jitterbug/WebService.pm b/lib/jitterbug/WebService.pm
index 62f55c0..c8be8fd 100644
--- a/lib/jitterbug/WebService.pm
+++ b/lib/jitterbug/WebService.pm
@@ -21,11 +21,18 @@ get '/build/:project/:commit/:version' => sub {
         open my $fh, '<', $file;
         my @content = <$fh>;
         close $fh;
-        {
-            commit  => $commit,
-            version => $version,
-            content => join( '', @content ),
-        };
+
+        if ( request->accept =~ m!application/json! ) {
+            return {
+                commit  => $commit,
+                version => $version,
+                content => join( '', @content ),
+            };
+        }
+        else {
+            content_type 'text/plain';
+            return join( '', @content );
+        }
     }
 };