mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Fix incorrect merge resolution of Http module
This commit is contained in:
parent
7d1376b273
commit
f3dfab8a94
1 changed files with 24 additions and 26 deletions
|
@ -13,9 +13,9 @@ interface Http
|
||||||
bytesBody,
|
bytesBody,
|
||||||
stringBody,
|
stringBody,
|
||||||
# jsonBody,
|
# jsonBody,
|
||||||
multiPartBody,
|
# multiPartBody,
|
||||||
stringPart,
|
# stringPart,
|
||||||
bytesPart,
|
# bytesPart,
|
||||||
handleStringResponse,
|
handleStringResponse,
|
||||||
defaultRequest,
|
defaultRequest,
|
||||||
errorToString,
|
errorToString,
|
||||||
|
@ -27,8 +27,8 @@ interface Http
|
||||||
# Json,
|
# Json,
|
||||||
Task.{ Task },
|
Task.{ Task },
|
||||||
# Encode.{ Encoding },
|
# Encode.{ Encoding },
|
||||||
HttpTypes.{ Request, Method, Header, Timeout, ProgressTracking, Part, Body, Response, Metadata, Error },
|
|
||||||
Url.{ Url },
|
Url.{ Url },
|
||||||
|
InternalHttp,
|
||||||
]
|
]
|
||||||
|
|
||||||
HttpErr a : [
|
HttpErr a : [
|
||||||
|
@ -78,28 +78,26 @@ stringBody = \mimeType, str ->
|
||||||
# jsonBody : a -> Body | a has Encoding
|
# jsonBody : a -> Body | a has Encoding
|
||||||
# jsonBody = \val ->
|
# jsonBody = \val ->
|
||||||
# Body (MimeType "application/json") (Encode.toBytes val Json.format)
|
# Body (MimeType "application/json") (Encode.toBytes val Json.format)
|
||||||
multiPartBody : List Part -> Body
|
#
|
||||||
multiPartBody = \parts ->
|
# multiPartBody : List Part -> Body
|
||||||
boundary = "7MA4YWxkTrZu0gW" # TODO: what's this exactly? a hash of all the part bodies?
|
# multiPartBody = \parts ->
|
||||||
beforeName = Str.toUtf8 "-- \(boundary)\r\nContent-Disposition: form-data; name=\""
|
# boundary = "7MA4YWxkTrZu0gW" # TODO: what's this exactly? a hash of all the part bodies?
|
||||||
afterName = Str.toUtf8 "\"\r\n"
|
# beforeName = Str.toUtf8 "-- \(boundary)\r\nContent-Disposition: form-data; name=\""
|
||||||
appendPart = \buffer, Part name partBytes ->
|
# afterName = Str.toUtf8 "\"\r\n"
|
||||||
buffer
|
# appendPart = \buffer, Part name partBytes ->
|
||||||
|> List.concat beforeName
|
# buffer
|
||||||
|> List.concat (Str.toUtf8 name)
|
# |> List.concat beforeName
|
||||||
|> List.concat afterName
|
# |> List.concat (Str.toUtf8 name)
|
||||||
|> List.concat partBytes
|
# |> List.concat afterName
|
||||||
bodyBytes = List.walk parts [] appendPart
|
# |> List.concat partBytes
|
||||||
|
# bodyBytes = List.walk parts [] appendPart
|
||||||
Body (MimeType "multipart/form-data;boundary=\"\(boundary)\"") bodyBytes
|
# Body (MimeType "multipart/form-data;boundary=\"\(boundary)\"") bodyBytes
|
||||||
|
# bytesPart : Str, List U8 -> Part
|
||||||
bytesPart : Str, List U8 -> Part
|
# bytesPart =
|
||||||
bytesPart =
|
# Part
|
||||||
Part
|
# stringPart : Str, Str -> Part
|
||||||
|
# stringPart = \name, str ->
|
||||||
stringPart : Str, Str -> Part
|
# Part name (Str.toUtf8 str)
|
||||||
stringPart = \name, str ->
|
|
||||||
Part name (Str.toUtf8 str)
|
|
||||||
|
|
||||||
handleStringResponse : Response -> Result Str Error
|
handleStringResponse : Response -> Result Str Error
|
||||||
handleStringResponse = \response ->
|
handleStringResponse = \response ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue