summary refs log tree commit diff
path: root/lib/jitterbug/WebService.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-09-25 15:32:57 +0200
committerfranck cuny <franck@lumberjaph.net>2010-09-25 15:32:57 +0200
commit535f564ebfc8d390a489fc8e0d800708c9fbe812 (patch)
treee5384d2e549ac3a4a30ddc60b98e2bb91faefa3f /lib/jitterbug/WebService.pm
parentload task, remove before_template (diff)
downloadjitterbug-535f564ebfc8d390a489fc8e0d800708c9fbe812.tar.gz
add permalink to test result in feed; api can return html for permalink
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 );
+        }
     }
 };