Skip to content

Instantly share code, notes, and snippets.

@rodesousa
Last active April 29, 2021 11:08
Show Gist options
  • Save rodesousa/81c873bf9ab4795115e1e38871e53cd3 to your computer and use it in GitHub Desktop.
Save rodesousa/81c873bf9ab4795115e1e38871e53cd3 to your computer and use it in GitHub Desktop.

Test de verif

for app <- [:hackney, :ibrowse, :httpc], true == Code.ensure_loaded?(app) do

Mettre les defstruct dans un même fichier

defmodule ExVCR.Record do defstruct options: nil, responses: nil end

defmodule ExVCR.Request do defstruct url: nil, headers: [], method: nil, body: nil, options: [], request_body: "" end

Pipeline de test

defp match_response(response, keys, recorder_options) do
    match_by_url(response, keys, recorder_options)
      and match_by_method(response, keys)
      and match_by_request_body(response, keys, recorder_options)
      and match_by_headers(response, keys, recorder_options)
      and match_by_custom_matchers(response, keys, recorder_options)
  end

URL POST

req_body = URI.encode_query(%{"name" => "who am i", "pass" => "$3cret"})
HTTPoison.post(
  "http://www.example.com/login",
  req_body,
  %{"Content-Type" => "application/x-www-form-urlencoded"}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment