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

coryodaniel / k8s / 807e93631268e5fd52ca29e3e4755088cf11bf27-PR-262

pending completion
807e93631268e5fd52ca29e3e4755088cf11bf27-PR-262

Pull #262

github

mruoss
add possibility to wait for delete
Pull Request #262: add possibility to wait for delete

6 of 6 new or added lines in 1 file covered. (100.0%)

732 of 1009 relevant lines covered (72.55%)

44.92 hits per line

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

80.0
/lib/k8s/middleware/request/encode_body.ex
1
defmodule K8s.Middleware.Request.EncodeBody do
2
  @moduledoc """
3
  Naive JSON body encoder.
4

5
  Encodes JSON payloads when given an modifiying HTTP verb, otherwise returns an empty string.
6
  """
7
  @behaviour K8s.Middleware.Request
8
  alias K8s.Middleware.Request
9

10
  @impl true
11
  def call(%Request{method: method, body: body} = req) do
12
    case encode(body, method) do
94✔
13
      {:ok, encoded_body} ->
14
        req = %Request{req | body: encoded_body}
94✔
15
        {:ok, req}
16

17
      error ->
18
        error
×
19
    end
20
  end
21

22
  @spec encode(any(), atom()) :: {:ok, binary} | {:error, any}
23
  defp encode(body, http_method) when http_method in [:put, :patch, :post], do: Jason.encode(body)
9✔
24
  defp encode(_, _), do: {:ok, nil}
85✔
25
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

© 2025 Coveralls, Inc