Skip to content

Commit

Permalink
update docment
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwencool committed Dec 18, 2016
1 parent 4d43957 commit bef6cc8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/maxwell/conn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ defmodule Maxwell.Conn do
Add query string to `conn.query_string`.
* `conn` - `%Conn{}`
* `query_key` - query key, for example `"name"`.
* `query_value` - query value, for example `"lucy"`.
* `key` - query key, for example `"name"`.
* `value` - query value, for example `"lucy"`.
### Examples
Expand Down
38 changes: 27 additions & 11 deletions lib/maxwell/multipart.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,38 @@ defmodule Maxwell.Multipart do
"""
@eof_size 2
@doc """
Receives lists list's member format:
multipart form encode.
1. `{:file, path}`
2. `{:file, path, extra_headers}`
3. `{:file, path, disposition, extra_headers}`
4. `{:mp_mixed, name, mixed_boundary}`
5. `{:mp_mixed_eof, mixed_boundary}`
6. `{name, bin_data}`
7. `{name, bin_data, extra_headers}`
8. `{name, bin_data, disposition, extra_headers}`
* `parts` - receives lists list's member format:
1. `{:file, path}`
2. `{:file, path, extra_headers}`
3. `{:file, path, disposition, extra_headers}`
4. `{:mp_mixed, name, mixed_boundary}`
5. `{:mp_mixed_eof, mixed_boundary}`
6. `{name, bin_data}`
7. `{name, bin_data, extra_headers}`
8. `{name, bin_data, disposition, extra_headers}`
Returns `{body_binary, size}`
"""
def encode_form(parts), do: encode_form(new_boundary, parts)
@doc """
See `encode_form/1`
multipart form encode.
* `boundary` - multipart boundary.
* `parts` - receives lists list's member format:
1. `{:file, path}`
2. `{:file, path, extra_headers}`
3. `{:file, path, disposition, extra_headers}`
4. `{:mp_mixed, name, mixed_boundary}`
5. `{:mp_mixed_eof, mixed_boundary}`
6. `{name, bin_data}`
7. `{name, bin_data, extra_headers}`
8. `{name, bin_data, disposition, extra_headers}`
"""
def encode_form(boundary, parts)when is_list(parts) do
encode_form(parts, boundary, "", 0)
Expand All @@ -40,7 +55,8 @@ defmodule Maxwell.Multipart do
@doc """
Get the size of a mp stream. Useful to calculate the content-length of a full multipart stream and send it as an identity
Receives parameter as `Maxwell.Multipart.encode`
* `boundary` - multipart boundary
* `parts` - see `Maxwell.Multipart.encode_form`.
Return stream size(integer)
"""
Expand Down

0 comments on commit bef6cc8

Please sign in to comment.