Skip to content

Commit

Permalink
update multipart boundary method see PR12
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwencool committed Nov 25, 2016
1 parent 627751e commit db1f3b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/maxwell/multipart.ex
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ defmodule Maxwell.Multipart do

defp mp_header(headers, boundary), do: "--" <> boundary <> "\r\n" <> (headers_to_binary(headers))

defp unique(size, acc\\"")
defp unique(0, acc), do: acc
defp unique(size, acc\\[])
defp unique(0, acc), do: acc |> :erlang.list_to_binary
defp unique(size, acc) do
random = Enum.random(?a..?z)
unique(size - 1, << acc::binary, random>>)
unique(size - 1, [random | acc])
end

defp headers_to_binary(headers) when is_list(headers) do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule Maxwell.Mixfile do
{:ex_doc, ">= 0.11.4", only: [:dev]},
{:markdown, github: "devinus/markdown", only: [:dev]},
{:cmark, "~> 0.6", only: [:dev]},
{:inch_ex, only: :docs},
{:inch_ex, "~> 0.5.4", only: :docs},
]
end

Expand Down

0 comments on commit db1f3b9

Please sign in to comment.