Try Install Learn Blog API Packages GitHub
Pages

FormData

Module to work with the FormData Web API.

FormData is generally used when sending messages via HTTP requests.

Functions

addFile
(
key
:
String
value
:
File
formData
:
FormData
)
:
FormData

Returns a new FormData object copying all values from the given one and adding the given file with the given key.

FormData.empty()
|> FormData.addFile(
  "key", File.fromString("Contents", "text.txt", "text/plain"))
addString
(
key
:
String
value
:
String
formData
:
FormData
)
:
FormData

Returns a new FormData object copying all values from the given one and adding the given string with the given key.

FormData.empty()
|> FormData.addString("key", "value")
empty
:
FormData

Returns an empty FormData object.

FormData.empty()
|> FormData.addString("key", "value")
keys
(
formData
:
FormData
)
:
Array(String)

Returns the keys of a FromData object.

FormData.empty()
|> FormData.addString("key", "value")
|> FormData.keys() == ["key"]