generated from tpl/purs
fix: use node url
This commit is contained in:
parent
a5182dd45a
commit
42f55418fc
@ -10,6 +10,7 @@ package:
|
|||||||
- maybe
|
- maybe
|
||||||
- newtype
|
- newtype
|
||||||
- node-buffer
|
- node-buffer
|
||||||
|
- node-url
|
||||||
- prelude
|
- prelude
|
||||||
- simple-json
|
- simple-json
|
||||||
- strings
|
- strings
|
||||||
|
@ -4,7 +4,6 @@ import Prelude
|
|||||||
|
|
||||||
import Control.Promise (Promise)
|
import Control.Promise (Promise)
|
||||||
import Control.Promise as Promise
|
import Control.Promise as Promise
|
||||||
import Data.Newtype (unwrap)
|
|
||||||
import Data.Nullable (Nullable)
|
import Data.Nullable (Nullable)
|
||||||
import Data.Nullable as Nullable
|
import Data.Nullable as Nullable
|
||||||
import Effect (Effect)
|
import Effect (Effect)
|
||||||
@ -15,8 +14,9 @@ import HTTP.Header (headers) as X
|
|||||||
import HTTP.Request (class Request, Method(..)) as X
|
import HTTP.Request (class Request, Method(..)) as X
|
||||||
import HTTP.Request as Req
|
import HTTP.Request as Req
|
||||||
import HTTP.Response (Response)
|
import HTTP.Response (Response)
|
||||||
|
import Node.URL (URL)
|
||||||
|
|
||||||
foreign import fetchImpl :: String -> String -> Object String -> Nullable Req.RawRequestBody -> Effect (Promise Response)
|
foreign import fetchImpl :: URL -> String -> Object String -> Nullable Req.RawRequestBody -> Effect (Promise Response)
|
||||||
|
|
||||||
fetch :: forall m a. MonadAff m => Req.Request a => a -> m Response
|
fetch :: forall m a. MonadAff m => Req.Request a => a -> m Response
|
||||||
fetch req = do
|
fetch req = do
|
||||||
@ -34,4 +34,4 @@ fetch req = do
|
|||||||
Req.DELETE -> "DELETE"
|
Req.DELETE -> "DELETE"
|
||||||
headers' = Object.fromFoldableWithIndex headers
|
headers' = Object.fromFoldableWithIndex headers
|
||||||
|
|
||||||
liftAff $ Promise.toAffE $ fetchImpl (unwrap url) methodStr headers' $ Nullable.toNullable body
|
liftAff $ Promise.toAffE $ fetchImpl url methodStr headers' $ Nullable.toNullable body
|
||||||
|
@ -34,7 +34,7 @@ import HTTP.Header (ContentType(..), Headers(..))
|
|||||||
import HTTP.Header as Header
|
import HTTP.Header as Header
|
||||||
import HTTP.MIME (MIME)
|
import HTTP.MIME (MIME)
|
||||||
import HTTP.MIME as MIME
|
import HTTP.MIME as MIME
|
||||||
import HTTP.URL (URL)
|
import Node.URL (URL)
|
||||||
import Node.Buffer (Buffer)
|
import Node.Buffer (Buffer)
|
||||||
import Node.Buffer as Buffer
|
import Node.Buffer as Buffer
|
||||||
import Node.Encoding (Encoding(..))
|
import Node.Encoding (Encoding(..))
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
module HTTP.URL where
|
|
||||||
|
|
||||||
import Prelude
|
|
||||||
|
|
||||||
import Data.Newtype (class Newtype)
|
|
||||||
|
|
||||||
newtype URL = URL String
|
|
||||||
|
|
||||||
derive instance Newtype URL _
|
|
||||||
derive newtype instance Show URL
|
|
||||||
derive newtype instance Eq URL
|
|
||||||
derive newtype instance Ord URL
|
|
Loading…
Reference in New Issue
Block a user