diff options
author | franck cuny <franck@lumberjaph.net> | 2010-09-25 15:32:57 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-09-25 15:32:57 +0200 |
commit | 535f564ebfc8d390a489fc8e0d800708c9fbe812 (patch) | |
tree | e5384d2e549ac3a4a30ddc60b98e2bb91faefa3f /lib/jitterbug/WebService.pm | |
parent | load task, remove before_template (diff) | |
download | jitterbug-535f564ebfc8d390a489fc8e0d800708c9fbe812.tar.gz |
add permalink to test result in feed; api can return html for permalink
Diffstat (limited to '')
-rw-r--r-- | lib/jitterbug/WebService.pm | 17 |
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 ); + } } }; |