-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
I'm having a curious problem when I use Node.HTTP.Client. When I try to use readString on the response, I get Nothing but if I pipe the responseStream to stdout (for instance), I can see the data. Specifically, I am using Node.HTTP.Client to get an access_code from a github oauth2 flow.
I'm posting this here because it looks like a stream issue, and to look for any guidance as to what I could look for.
Here is the code:
affRequest :: forall eff. Options RequestOptions -> (Request -> Eff (err :: EXCEPTION, console :: CONSOLE, http :: HTTP | eff) Unit) -> Aff (err :: EXCEPTION, console :: CONSOLE, http :: HTTP | eff) (Maybe String)
affRequest opts f = makeAff \_ cb -> do
req <- request opts \res -> do
let responseStream = responseAsStream res
mc <- readString responseStream Nothing UTF8
pipe responseStream stdout
cb mc
mc is Nothing, but I can see the correct data (the access_code) on stdout.
Cheers.
Metadata
Metadata
Assignees
Labels
No labels