@@ -7,7 +7,7 @@ def test_http_post_returns_id(sess):
7
7
(request_id ,) = sess .execute (
8
8
"""
9
9
select net.http_post(
10
- url:='https ://httpbin.org /post',
10
+ url:='http ://localhost:8080 /post',
11
11
body:='{}'::jsonb
12
12
);
13
13
"""
@@ -22,7 +22,7 @@ def test_http_post_special_chars_body(sess):
22
22
(request_id ,) = sess .execute (
23
23
"""
24
24
select net.http_post(
25
- url:='https ://httpbin.org /post',
25
+ url:='http ://localhost:8080 /post',
26
26
body:=json_build_object('foo', 'ba"r')::jsonb
27
27
);
28
28
"""
@@ -38,7 +38,7 @@ def test_http_post_collect_sync_success(sess):
38
38
(request_id ,) = sess .execute (
39
39
"""
40
40
select net.http_post(
41
- url:='https ://httpbin.org /post'
41
+ url:='http ://localhost:8080 /post'
42
42
);
43
43
"""
44
44
).fetchone ()
@@ -60,8 +60,6 @@ def test_http_post_collect_sync_success(sess):
60
60
assert response [0 ] == "SUCCESS"
61
61
assert response [1 ] == "ok"
62
62
assert response [2 ] is not None
63
- # psycopg2 does not deserialize nested composites
64
- assert response [2 ].startswith ("(200" )
65
63
66
64
67
65
# def test_http_post_collect_async_pending(sess):
@@ -71,7 +69,7 @@ def test_http_post_collect_sync_success(sess):
71
69
# (request_id,) = sess.execute(
72
70
# """
73
71
# select net.http_post(
74
- # url:='https ://httpbin.org /post',
72
+ # url:='http ://localhost:8080 /post',
75
73
# body:='{}'::jsonb
76
74
# );
77
75
# """
@@ -98,14 +96,12 @@ def test_http_post_collect_sync_success(sess):
98
96
99
97
def test_http_post_collect_non_empty_body (sess ):
100
98
"""Collect a response async before completed"""
101
- # Equivalent to
102
- # curl -X POST "https://httpbin.org/post" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"hello\":\"world\"}"
103
99
104
100
# Create a request
105
101
(request_id ,) = sess .execute (
106
102
"""
107
103
select net.http_post(
108
- url:='https ://httpbin.org /post',
104
+ url:='http ://localhost:8080 /post',
109
105
body:='{"hello": "world"}'::jsonb,
110
106
headers:='{"Content-Type": "application/json", "accept": "application/json"}'::jsonb
111
107
);
@@ -127,7 +123,6 @@ def test_http_post_collect_non_empty_body(sess):
127
123
assert response is not None
128
124
assert response [0 ] == "SUCCESS"
129
125
assert "ok" in response [1 ]
130
- assert "json" in response [2 ]
131
126
assert "hello" in response [2 ]
132
127
assert "world" in response [2 ]
133
128
@@ -144,7 +139,7 @@ def test_http_post_collect_non_empty_body(sess):
144
139
{"request_id" : request_id },
145
140
).fetchone ()
146
141
147
- assert response_json ["json" ][ " hello" ] == "world"
142
+ assert response_json ["hello" ] == "world"
148
143
149
144
150
145
def test_http_post_wrong_header_exception (sess ):
@@ -156,7 +151,7 @@ def test_http_post_wrong_header_exception(sess):
156
151
sess .execute (
157
152
"""
158
153
select net.http_post(
159
- url:='https ://httpbin.org /post',
154
+ url:='http ://localhost:8080 /post',
160
155
headers:='{"Content-Type": "application/text"}'::jsonb
161
156
);
162
157
"""
@@ -175,7 +170,7 @@ def test_http_post_no_content_type_coerce(sess):
175
170
request_id , = sess .execute (
176
171
"""
177
172
select net.http_post(
178
- url:='https ://httpbin.org /post',
173
+ url:='http ://localhost:8080 /post',
179
174
headers:='{"other": "val"}'::jsonb
180
175
);
181
176
"""
0 commit comments