parent
ac66323394
commit
a79f73a040
@ -1242,8 +1242,9 @@ request reqBuilder = do
|
|||||||
BS8.concat $ separator : [BS8.concat [multipartPart p, separator] | p <- parts]
|
BS8.concat $ separator : [BS8.concat [multipartPart p, separator] | p <- parts]
|
||||||
multipartPart (ReqKvPart k v) = BS8.concat
|
multipartPart (ReqKvPart k v) = BS8.concat
|
||||||
[ "Content-Disposition: form-data; "
|
[ "Content-Disposition: form-data; "
|
||||||
, "name=\"", TE.encodeUtf8 k, "\"\r\n\r\n"
|
, "name=\"", enc k, "\"\r\n\r\n"
|
||||||
, TE.encodeUtf8 v, "\r\n"]
|
, enc v, "\r\n"]
|
||||||
|
where enc = H.urlEncode False . TE.encodeUtf8
|
||||||
multipartPart (ReqFilePart k v bytes mime) = BS8.concat
|
multipartPart (ReqFilePart k v bytes mime) = BS8.concat
|
||||||
[ "Content-Disposition: form-data; "
|
[ "Content-Disposition: form-data; "
|
||||||
, "name=\"", TE.encodeUtf8 k, "\"; "
|
, "name=\"", TE.encodeUtf8 k, "\"; "
|
||||||
@ -1266,14 +1267,14 @@ request reqBuilder = do
|
|||||||
([ ("Cookie", cookieValue) ] ++ headersForPostData rbdPostData)
|
([ ("Cookie", cookieValue) ] ++ headersForPostData rbdPostData)
|
||||||
method extraHeaders urlPath urlQuery)
|
method extraHeaders urlPath urlQuery)
|
||||||
simpleRequestBody' (MultipleItemsPostData x) =
|
simpleRequestBody' (MultipleItemsPostData x) =
|
||||||
BSL8.fromChunks $ return $ TE.encodeUtf8 $ T.intercalate "&"
|
BSL8.fromChunks $ return $ H.renderSimpleQuery False
|
||||||
$ map singlepartPart x
|
$ concatMap singlepartPart x
|
||||||
simpleRequestBody' (BinaryPostData x) = x
|
simpleRequestBody' (BinaryPostData x) = x
|
||||||
cookieValue = Builder.toByteString $ Cookie.renderCookies cookiePairs
|
cookieValue = Builder.toByteString $ Cookie.renderCookies cookiePairs
|
||||||
cookiePairs = [ (Cookie.setCookieName c, Cookie.setCookieValue c)
|
cookiePairs = [ (Cookie.setCookieName c, Cookie.setCookieValue c)
|
||||||
| c <- map snd $ M.toList cookies ]
|
| c <- map snd $ M.toList cookies ]
|
||||||
singlepartPart (ReqFilePart _ _ _ _) = ""
|
singlepartPart (ReqFilePart _ _ _ _) = []
|
||||||
singlepartPart (ReqKvPart k v) = T.concat [k,"=",v]
|
singlepartPart (ReqKvPart k v) = [(TE.encodeUtf8 k, TE.encodeUtf8 v)]
|
||||||
|
|
||||||
-- If the request appears to be submitting a form (has key-value pairs) give it the form-urlencoded Content-Type.
|
-- If the request appears to be submitting a form (has key-value pairs) give it the form-urlencoded Content-Type.
|
||||||
-- The previous behavior was to always use the form-urlencoded Content-Type https://github.com/yesodweb/yesod/issues/1063
|
-- The previous behavior was to always use the form-urlencoded Content-Type https://github.com/yesodweb/yesod/issues/1063
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user