diff --git a/examples/interactive/cli-platform/Http.roc b/examples/interactive/cli-platform/Http.roc index 3943460e62..9e17f528c6 100644 --- a/examples/interactive/cli-platform/Http.roc +++ b/examples/interactive/cli-platform/Http.roc @@ -13,9 +13,9 @@ interface Http bytesBody, stringBody, # jsonBody, - multiPartBody, - stringPart, - bytesPart, + # multiPartBody, + # stringPart, + # bytesPart, handleStringResponse, defaultRequest, errorToString, @@ -27,8 +27,8 @@ interface Http # Json, Task.{ Task }, # Encode.{ Encoding }, - HttpTypes.{ Request, Method, Header, Timeout, ProgressTracking, Part, Body, Response, Metadata, Error }, Url.{ Url }, + InternalHttp, ] HttpErr a : [ @@ -78,28 +78,26 @@ stringBody = \mimeType, str -> # jsonBody : a -> Body | a has Encoding # jsonBody = \val -> # Body (MimeType "application/json") (Encode.toBytes val Json.format) -multiPartBody : List Part -> Body -multiPartBody = \parts -> - boundary = "7MA4YWxkTrZu0gW" # TODO: what's this exactly? a hash of all the part bodies? - beforeName = Str.toUtf8 "-- \(boundary)\r\nContent-Disposition: form-data; name=\"" - afterName = Str.toUtf8 "\"\r\n" - appendPart = \buffer, Part name partBytes -> - buffer - |> List.concat beforeName - |> List.concat (Str.toUtf8 name) - |> List.concat afterName - |> List.concat partBytes - bodyBytes = List.walk parts [] appendPart - - Body (MimeType "multipart/form-data;boundary=\"\(boundary)\"") bodyBytes - -bytesPart : Str, List U8 -> Part -bytesPart = - Part - -stringPart : Str, Str -> Part -stringPart = \name, str -> - Part name (Str.toUtf8 str) +# +# multiPartBody : List Part -> Body +# multiPartBody = \parts -> +# boundary = "7MA4YWxkTrZu0gW" # TODO: what's this exactly? a hash of all the part bodies? +# beforeName = Str.toUtf8 "-- \(boundary)\r\nContent-Disposition: form-data; name=\"" +# afterName = Str.toUtf8 "\"\r\n" +# appendPart = \buffer, Part name partBytes -> +# buffer +# |> List.concat beforeName +# |> List.concat (Str.toUtf8 name) +# |> List.concat afterName +# |> List.concat partBytes +# bodyBytes = List.walk parts [] appendPart +# Body (MimeType "multipart/form-data;boundary=\"\(boundary)\"") bodyBytes +# bytesPart : Str, List U8 -> Part +# bytesPart = +# Part +# stringPart : Str, Str -> Part +# stringPart = \name, str -> +# Part name (Str.toUtf8 str) handleStringResponse : Response -> Result Str Error handleStringResponse = \response ->