Skip to content

Instantly share code, notes, and snippets.

@Kah0ona
Created March 8, 2016 15:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Kah0ona/11c338cef61cd83ec7f0 to your computer and use it in GitHub Desktop.
response content-length is reset to 0
(def plural "files")
(def file-routes
(context (str "/api/" plural) []
:tags [plural]
(GET "/" {:as request}
:tags [plural]
:query-params [file-type :- s/Str
file-id :- s/Any]
:summary (str "Streams (private) files to the client ")
:middleware [auth/wrap-auth-token auth/wrap-authenticated-check]
:description (str "Streams (private) files to the client ")
; this function returns a normal response, with
(find-and-stream-file (:upload-dir request) file-type file-id
{:connection (:db request)
:result-set-fn first}))))
(def app
(-> (api/api
{:exceptions {:handlers
{:ex/response-validation (ex/with-logging ex/response-validation-handler :error)}}}
(ring.swagger.ui/swagger-ui "/api-docs")
(compojure.api.swagger/swagger-docs)
auth/authentication-routes
d/department-routes
c/candidate-routes
e/employee-routes
j/job-routes
t/tag-routes
pq/preselection_question-routes
f/file-routes)
wrap-db ;add the database conn to the request
wrap-uploaddir
wrap-reload
(auth/wrap-auth-cookie (:cookie-secret env))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment