@@ -15,7 +15,6 @@ module Fetch
1515
1616import Prelude
1717
18−import Control.Promise as Promise
1918import Data.HTTP.Method (Method(..))
2019import Effect.Aff (Aff)
2120import Effect.Class (liftEffect)
@@ -26,20 +25,21 @@ import Fetch.Core.Request as CoreRequest
2625import Fetch.Core.RequestCache (RequestCache(..))
2726import Fetch.Core.RequestCredentials (RequestCredentials(Omit, Include))
2827import Fetch.Core.RequestMode (RequestMode(Cors, NoCors, Navigate))
28+import Fetch.Internal.Headers (lookup, toHeaders, contains)
2929import Fetch.Internal.Request (class ToCoreRequestOptions, class ToCoreRequestOptionsConverter, class ToCoreRequestOptionsHelper, HighlevelRequestOptions, convertHelper, convertImpl, new)
3030import Fetch.Internal.Request as Request
31−import Fetch.Internal.Headers (lookup, toHeaders, contains)
3231import Fetch.Internal.RequestBody (class ToRequestBody, toRequestBody)
33−import Fetch.Internal.Response (Response, ResponseR, arrayBuffer, blob, body, json, promiseToPromise, text)
32+import Fetch.Internal.Response (Response, ResponseR, arrayBuffer, blob, body, json, text)
3433import Fetch.Internal.Response as Response
3534import Prim.Row (class Union)
35+import Promise.Aff as Promise.Aff
3636
3737-- | Implementation of `fetch`, see https://developer.mozilla.org/en-US/docs/Web/API/fetch
3838-- | For usage with `String` bodies. For other body types, see `fetchBody`
39−-- |
39+-- |
4040-- | Usage:
4141-- | ```purescript
42−-- | do
42+-- | do
4343-- | let requestUrl = "https://httpbin.org/get"
4444-- | { status, text } <- fetch requestUrl { headers: { "Accept": "application/json" }}
4545-- | responseBody <- text
@@ -66,7 +66,7 @@ fetch
6666 -> Aff Response
6767fetch url r = do
6868 request <- liftEffect $ new url $ Request.convert r
69− cResponse <- Promise.toAffE $ Response.promiseToPromise <$> Core.fetch request
69+ cResponse <- Promise.Aff.toAffE $ Core.fetch request
7070 pure $ Response.convert cResponse
7171
7272-- | Like `fetch`, but can accept arbitrary `RequestBody`s.
@@ -81,5 +81,5 @@ fetchBody
8181 -> Aff Response
8282fetchBody url r = do
8383 request <- liftEffect $ new url $ Request.convert r
84− cResponse <- Promise.toAffE $ Response.promiseToPromise <$> Core.fetch request
84+ cResponse <- Promise.Aff.toAffE $ Core.fetch request
8585 pure $ Response.convert cResponse