Header menu logo FsHttp

Sending Multipart Form-Data

Performing a POST multipart request / uploading a file:

http {
    POST "https://mysite"

    // use "multipart" keyword (instead of 'body') to start specifying parts
    multipart
    textPart "the-actual-value_1" "the-part-name_1"
    textPart "the-actual-value_2" "the-part-name_2"
    filePart "super.txt" "F# rocks!"
}
|> Request.send

Further Readings

Have a look at the https://github.com/fsprojects/FsHttp/blob/master/src/Tests/Multipart.fs for more examples using multipart.

namespace FsHttp
Multiple items
static member HttpBuilder.http: HeaderContext

--------------------
property HttpBuilder.http: HeaderContext with get
custom operation: POST (string) Calls IRequestContext.Post
custom operation: multipart Calls IRequestContext.Multipart
<summary> An explicit transformation from a previous context to allow for describing the request multiparts. </summary>
custom operation: textPart (string) (string) (string option) Calls IRequestContext.TextPart
custom operation: filePart (string) (string option) (string option) Calls IRequestContext.FilePart
Multiple items
module Request from FsHttp.Print

--------------------
module Request from FsHttp

--------------------
type Request = { header: Header content: BodyContent config: Config printHint: PrintHint }
val send: request: IToRequest -> Response
<summary> Sends a request synchronously. </summary>

Type something to start searching.