Maxwell.Adapter.Util (maxwell v2.4.0) View Source

Utils for Adapter

Link to this section Summary

Functions

Check req_headers has transfer-encoding: chunked.

Add content-type to headers if don't have; Add content-length to headers if not chunked

Converts the headers map to a list of tuples.

Encode multipart form.

Fetch the first element from stream.

Append path and query string to url

Link to this section Functions

Check req_headers has transfer-encoding: chunked.

Link to this function

file_header_transform(chunked, conn)

View Source

Add content-type to headers if don't have; Add content-length to headers if not chunked

Link to this function

header_serialize(headers)

View Source

Converts the headers map to a list of tuples.

  • headers - Map.t, for example: %{"content-type" => "application/json"}

Examples

 iex> headers_serialize(%{"content-type" => "application/json"})
 [{"content-type", "application/json"}]
Link to this function

multipart_encode(conn, multiparts)

View Source

Encode multipart form.

Link to this function

stream_iterate(filepath)

View Source

Fetch the first element from stream.

Link to this function

url_serialize(url, path, query_string, type \\ :string)

View Source

Append path and query string to url

  • url - conn.url
  • path - conn.path
  • query - conn.query
  • type - :char_list or :string, default is :string

Examples

#http://example.com/home?name=foo
iex> url_serialize("http://example.com", "/home", %{"name" => "foo"})