• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

camatcode / basenji / f6d2cc6fd9464bda125e7322f1fb3032e4b8828a

07 Jul 2025 04:30AM UTC coverage: 64.894% (-0.03%) from 64.928%
f6d2cc6fd9464bda125e7322f1fb3032e4b8828a

Pull #26

github

camatcode
feat(comics): add image preview
Pull Request #26: feat(comics): add image preview

13 of 17 new or added lines in 4 files covered. (76.47%)

3 existing lines in 1 file now uncovered.

366 of 564 relevant lines covered (64.89%)

403.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.78
/lib/basenji_web/controllers/api/comics_controller.ex
1
defmodule BasenjiWeb.ComicsController do
2
  @moduledoc false
3
  use BasenjiWeb, :controller
4

5
  alias Basenji.Comics
6
  alias BasenjiWeb.API.Utils
7

8
  def get_page(conn, params) do
9
    id = params["id"]
4✔
10
    page = params["page"]
4✔
11

NEW
12
    with {:ok, page_num} <- Utils.safe_to_int(page) do
×
13
      Comics.get_page(id, page_num)
4✔
14
    end
15
    |> case do
4✔
16
      {:ok, binary, mime} ->
17
        length = byte_size(binary)
4✔
18

19
        conn
20
        |> merge_resp_headers([{"access-control-allow-origin", "*"}])
21
        |> merge_resp_headers([{"content-type", mime}])
22
        |> merge_resp_headers([{"content-length", "#{length}"}])
4✔
23
        |> merge_resp_headers([{"content-disposition", "attachment"}])
24
        |> send_resp(200, binary)
4✔
25

26
      error ->
27
        Utils.bad_request_handler(conn, error)
×
28
    end
29
  end
30
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc