Skip to content

Commit 0fcd230

Browse files
author
Mike Solomon
committed
Uses json test
1 parent 551c0dd commit 0fcd230

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# purescript-affjax.py
22

3-
A port of affjax to purescript-python
3+
An experimental port of affjax to purescript-python.

python-ffi/Affjax.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444

4545
# todo - is there an analog for withCredentials here?
4646
def _ajax(mkHeader, options):
47+
print("called ajax")
48+
4749
def _1(errback, callback):
50+
print("STARTING")
4851
if options["responseType"] in ["arraybuffer", "blob", "document"]:
4952
errback(
5053
Exception(
@@ -75,6 +78,7 @@ def _toThreading():
7578
headers=headers,
7679
)
7780
r1 = conn.getresponse()
81+
print("LOOK HERE")
7882
callback(
7983
{
8084
"status": r1.status,

src/Main.purs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import Data.Argonaut.Core as J
77
import Data.Either (Either(..))
88
import Data.HTTP.Method (Method(..))
99
import Effect.Aff (launchAff)
10+
import Effect.Class (liftEffect)
1011
import Effect.Class.Console (log)
1112

1213
main =
1314
void $ launchAff
1415
$ do
15-
result <- AX.request (AX.defaultRequest { url = "/api", method = Left GET, responseFormat = ResponseFormat.json })
16+
let
17+
r = AX.defaultRequest { url = "http://ip.jsontest.com/", method = Left GET, responseFormat = ResponseFormat.json }
18+
result <- AX.request r
1619
case result of
17-
Left err -> log $ "GET /api response failed to decode: " <> AX.printError err
20+
Left err -> log $ "GET response failed to decode: " <> AX.printError err
1821
Right response -> log $ "GET /api response: " <> J.stringify response.body

0 commit comments

Comments
 (0)