8000 GitHub - andrewtimberlake/sham: An Elixir mock HTTP(S) server useful for testing HTTP(S) clients.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

An Elixir mock HTTP(S) server useful for testing HTTP(S) clients.

License

Notifications You must be signed in to change notification settings

andrewtimberlake/sham

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sham

An Elixir mock HTTP(S) server useful for testing HTTP(S) clients.

example workflow Hex version badge Hex Docs License badge

Usage

  sham = Sham.start(ssl: true, certfile: "/path/to/cert.pem", keyfile: "/path/to/key.pem")

  Sham.expect(sham, "GET", "/", fn conn ->
    Plug.Conn.resp(conn, 200, "Hello world")
  end)

  {:ok, 200, response_body} = HttpClient.get("https://localhost:#{sham.port}")

  assert response_body == "Hello world"

Installation

The package can be installed by adding sham to your list of dependencies in mix.exs:

def deps do
  [
    {:sham, "~> 1.0"}
  ]
end

Documentation is available at https://hexdocs.pm/sham.

SSL

Generate Keys

openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout priv/ssl/key.pem -out priv/ssl/cert.pem

About

Thank you for using this library.

If you’d like to support me, I am available for Elixir consulting and online pair programming.

I am also the founder of Sitesure which provides uptime and background monitoring, notifying you immediately when your services go down.

About

An Elixir mock HTTP(S) server useful for testing HTTP(S) clients.

Resources

License

Stars

Watchers

Forks

Languages

0