Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-06-06 14:16:30 +0300
committerDouwe Maan <douwe@selenight.nl>2016-06-06 14:16:30 +0300
commit8c3ba8d6c9021f250fb1597f6b597d817af46b38 (patch)
tree0282f6ce75ad214634839ab04cc1f111af06cd35 /app/helpers/workhorse_helper.rb
parent3cb69f0c0b0049426e6abad0914812a9eef87b04 (diff)
Add workhorse controller and API helpers
Diffstat (limited to 'app/helpers/workhorse_helper.rb')
-rw-r--r--app/helpers/workhorse_helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/workhorse_helper.rb b/app/helpers/workhorse_helper.rb
new file mode 100644
index 00000000000..9d306c9096e
--- /dev/null
+++ b/app/helpers/workhorse_helper.rb
@@ -0,0 +1,17 @@
+# Helpers to send Git blobs or archives through Workhorse.
+# Workhorse will also serve files when using `send_file`.
+module WorkhorseHelper
+ # Send a Git blob through Workhorse
+ def send_git_blob(repository, blob)
+ headers.store(*Gitlab::Workhorse.send_git_blob(repository, blob))
+ headers['Content-Disposition'] = 'inline'
+ headers['Content-Type'] = safe_content_type(blob)
+ head :ok # 'render nothing: true' messes up the Content-Type
+ end
+
+ # Archive a Git repository and send it through Workhorse
+ def send_git_archive(repository, ref:, format:)
+ headers.store(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format))
+ head :ok
+ end
+end