Rely on redirect also for Accept: json
This commit is contained in:
parent
92ee6b9aaf
commit
23db42fed3
1 changed files with 3 additions and 12 deletions
|
@ -330,15 +330,6 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs =
|
||||||
Dream.sql req (Model.latest_successful_build_uuid job_id platform))
|
Dream.sql req (Model.latest_successful_build_uuid job_id platform))
|
||||||
>>= Model.not_found
|
>>= Model.not_found
|
||||||
|> if_error "Error getting job" >>= fun build ->
|
|> if_error "Error getting job" >>= fun build ->
|
||||||
match Dream.header req "Accept" with
|
|
||||||
| Some accept when String.starts_with ~prefix:"application/json" accept ->
|
|
||||||
let json_response =
|
|
||||||
`Assoc [
|
|
||||||
"uuid", `String (Uuidm.to_string build);
|
|
||||||
] |> Yojson.Basic.to_string
|
|
||||||
in
|
|
||||||
Dream.json ~status:`OK json_response |> Lwt_result.ok
|
|
||||||
| _ ->
|
|
||||||
Dream.redirect req
|
Dream.redirect req
|
||||||
(Link.Job_build_artifact.make_from_string ~job_name ~build ~artifact ())
|
(Link.Job_build_artifact.make_from_string ~job_name ~build ~artifact ())
|
||||||
|> Lwt_result.ok
|
|> Lwt_result.ok
|
||||||
|
|
Loading…
Reference in a new issue