Current section
34 Versions
Jump to
Current section
34 Versions
Compare versions
16
files changed
+329
additions
-229
deletions
| @@ -52,7 +52,7 @@ end | |
| 52 52 | |
| 53 53 | defp deps do |
| 54 54 | [ |
| 55 | - {:http_proxy, "~> 1.2.1"} |
| 55 | + {:http_proxy, "~> 1.3.0"} |
| 56 56 | ] |
| 57 57 | end |
| 58 58 | ``` |
| @@ -2,16 +2,18 @@ | |
| 2 2 | {<<"build_tools">>,[<<"mix">>]}. |
| 3 3 | {<<"description">>, |
| 4 4 | <<"Multi port HTTP Proxy and support record/play request.">>}. |
| 5 | - {<<"elixir">>,<<"~> 1.4">>}. |
| 5 | + {<<"elixir">>,<<"~> 1.6">>}. |
| 6 6 | {<<"files">>, |
| 7 | - [<<"lib/http_proxy.ex">>,<<"lib/http_proxy/agent.ex">>, |
| 8 | - <<"lib/http_proxy/data.ex">>,<<"lib/http_proxy/format.ex">>, |
| 9 | - <<"lib/http_proxy/handle.ex">>,<<"lib/http_proxy/play/body.ex">>, |
| 7 | + [<<"lib">>,<<"lib/http_proxy">>,<<"lib/http_proxy.ex">>, |
| 8 | + <<"lib/http_proxy/agent.ex">>,<<"lib/http_proxy/data.ex">>, |
| 9 | + <<"lib/http_proxy/format.ex">>,<<"lib/http_proxy/handle.ex">>, |
| 10 | + <<"lib/http_proxy/play">>,<<"lib/http_proxy/play/body.ex">>, |
| 10 11 | <<"lib/http_proxy/play/data.ex">>,<<"lib/http_proxy/play/paths.ex">>, |
| 11 | - <<"lib/http_proxy/play/response.ex">>, |
| 12 | + <<"lib/http_proxy/play/response.ex">>,<<"lib/http_proxy/record">>, |
| 12 13 | <<"lib/http_proxy/record/response.ex">>,<<"lib/http_proxy/supervisor.ex">>, |
| 13 | - <<"lib/http_proxy/utils/file.ex">>,<<"lib/http_proxy/utils/utils.ex">>, |
| 14 | - <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}. |
| 14 | + <<"lib/http_proxy/utils">>,<<"lib/http_proxy/utils/file.ex">>, |
| 15 | + <<"lib/http_proxy/utils/utils.ex">>,<<"mix.exs">>,<<"README.md">>, |
| 16 | + <<"LICENSE">>]}. |
| 15 17 | {<<"licenses">>,[<<"MIT">>]}. |
| 16 18 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/KazuCocoa/http_proxy">>}]}. |
| 17 19 | {<<"maintainers">>,[<<"Kazuaki Matsuo">>]}. |
| @@ -20,17 +22,21 @@ | |
| 20 22 | [[{<<"app">>,<<"exjsx">>}, |
| 21 23 | {<<"name">>,<<"exjsx">>}, |
| 22 24 | {<<"optional">>,false}, |
| 25 | + {<<"repository">>,<<"hexpm">>}, |
| 23 26 | {<<"requirement">>,<<"~> 4.0.0">>}], |
| 24 27 | [{<<"app">>,<<"hackney">>}, |
| 25 28 | {<<"name">>,<<"hackney">>}, |
| 26 29 | {<<"optional">>,false}, |
| 30 | + {<<"repository">>,<<"hexpm">>}, |
| 27 31 | {<<"requirement">>,<<"1.6.5">>}], |
| 28 32 | [{<<"app">>,<<"cowboy">>}, |
| 29 33 | {<<"name">>,<<"cowboy">>}, |
| 30 34 | {<<"optional">>,false}, |
| 35 | + {<<"repository">>,<<"hexpm">>}, |
| 31 36 | {<<"requirement">>,<<"~> 1.1.2">>}], |
| 32 37 | [{<<"app">>,<<"plug">>}, |
| 33 38 | {<<"name">>,<<"plug">>}, |
| 34 39 | {<<"optional">>,false}, |
| 40 | + {<<"repository">>,<<"hexpm">>}, |
| 35 41 | {<<"requirement">>,<<"~> 1.4.0">>}]]}. |
| 36 | - {<<"version">>,<<"1.2.3">>}. |
| 42 | + {<<"version">>,<<"1.3.0">>}. |
| @@ -57,7 +57,7 @@ defmodule HttpProxy do | |
| 57 57 | |
| 58 58 | @spec start(:normal, []) :: {:ok, pid} |
| 59 59 | def start(_type, _args) do |
| 60 | - HttpProxySup.start_link |
| 60 | + HttpProxySup.start_link() |
| 61 61 | end |
| 62 62 | |
| 63 63 | @doc """ |
| @@ -65,15 +65,15 @@ defmodule HttpProxy do | |
| 65 65 | """ |
| 66 66 | @spec stop :: :ok | {:error, term} |
| 67 67 | def stop do |
| 68 | - Application.stop :ranch |
| 69 | - Application.stop :cowlib |
| 70 | - Application.stop :cowboy |
| 71 | - Application.stop :idna |
| 72 | - Application.stop :mimerl |
| 73 | - Application.stop :certifi |
| 74 | - Application.stop :hackney |
| 75 | - Application.stop :plug |
| 76 | - Application.stop :http_proxy |
| 68 | + Application.stop(:ranch) |
| 69 | + Application.stop(:cowlib) |
| 70 | + Application.stop(:cowboy) |
| 71 | + Application.stop(:idna) |
| 72 | + Application.stop(:mimerl) |
| 73 | + Application.stop(:certifi) |
| 74 | + Application.stop(:hackney) |
| 75 | + Application.stop(:plug) |
| 76 | + Application.stop(:http_proxy) |
| 77 77 | end |
| 78 78 | |
| 79 79 | @doc """ |
| @@ -82,14 +82,14 @@ defmodule HttpProxy do | |
| 82 82 | """ |
| 83 83 | @spec start() :: :ok | {:error, term} |
| 84 84 | def start do |
| 85 | - Application.start :ranch |
| 86 | - Application.start :cowlib |
| 87 | - Application.start :cowboy |
| 88 | - Application.start :idna |
| 89 | - Application.start :mimerl |
| 90 | - Application.start :certifi |
| 91 | - Application.start :hackney |
| 92 | - Application.start :plug |
| 93 | - Application.start :http_proxy |
| 85 | + Application.start(:ranch) |
| 86 | + Application.start(:cowlib) |
| 87 | + Application.start(:cowboy) |
| 88 | + Application.start(:idna) |
| 89 | + Application.start(:mimerl) |
| 90 | + Application.start(:certifi) |
| 91 | + Application.start(:hackney) |
| 92 | + Application.start(:plug) |
| 93 | + Application.start(:http_proxy) |
| 94 94 | end |
| 95 95 | end |
| @@ -7,21 +7,18 @@ defmodule HttpProxy.Agent do | |
| 7 7 | alias HttpProxy.Play.Paths |
| 8 8 | |
| 9 9 | @spec start_link() :: {:ok, pid} | {:error, {:already_started, pid} | term} |
| 10 | - def start_link, |
| 11 | - do: Agent.start(&Map.new/0, name: __MODULE__) |
| 10 | + def start_link, do: Agent.start(&Map.new/0, name: __MODULE__) |
| 12 11 | |
| 13 12 | @spec put(atom, [binary] | binary | nil) :: :ok |
| 14 | - def put(key, value), |
| 15 | - do: Agent.update(__MODULE__, &Map.put(&1, key, value)) |
| 13 | + def put(key, value), do: Agent.update(__MODULE__, &Map.put(&1, key, value)) |
| 16 14 | |
| 17 15 | @spec get(atom) :: binary | nil |
| 18 | - def get(key), |
| 19 | - do: Agent.get(__MODULE__, &Map.get(&1, key)) |
| 16 | + def get(key), do: Agent.get(__MODULE__, &Map.get(&1, key)) |
| 20 17 | |
| 21 18 | @spec clear() :: :ok |
| 22 19 | def clear do |
| 23 | - Data.clear_responses |
| 24 | - Paths.clear_paths |
| 25 | - Paths.clear_path_patterns |
| 20 | + Data.clear_responses() |
| 21 | + Paths.clear_paths() |
| 22 | + Paths.clear_path_patterns() |
| 26 23 | end |
| 27 24 | end |
| @@ -1,7 +1,6 @@ | |
| 1 1 | defmodule HttpProxy.Data do |
| 2 2 | @moduledoc false |
| 3 3 | |
| 4 | - |
| 5 4 | @doc ~S""" |
| 6 5 | HTTP request/response structure used record/play them. |
| 7 6 | |
| @@ -11,6 +10,18 @@ defmodule HttpProxy.Data do | |
| 11 10 | %HttpProxy.Data{request: [:url, :remote, :method, :headers, :request_body, :options], |
| 12 11 | response: [:body, :cookies, :status_code, :headers]} |
| 13 12 | """ |
| 14 | - defstruct request: [:url, :remote, :method, :headers, :request_body, :options], |
| 15 | - response: [:body, :cookies, :status_code, :headers] |
| 13 | + defstruct request: [ |
| 14 | + :url, |
| 15 | + :remote, |
| 16 | + :method, |
| 17 | + :headers, |
| 18 | + :request_body, |
| 19 | + :options |
| 20 | + ], |
| 21 | + response: [ |
| 22 | + :body, |
| 23 | + :cookies, |
| 24 | + :status_code, |
| 25 | + :headers |
| 26 | + ] |
| 16 27 | end |
Loading more files…