Skip to content

Commit 82551f7

Browse files
committed
fix: remove unnecessary not null from queue table
1 parent bc2421b commit 82551f7

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ The extension introduces a new `net` schema, which contains two unlogged tables,
6464
id bigint NOT NULL DEFAULT nextval('net.http_request_queue_id_seq'::regclass),
6565
method text NOT NULL,
6666
url text NOT NULL,
67-
headers jsonb NOT NULL,
68-
body bytea NULL,
67+
headers jsonb,
68+
body bytea,
6969
timeout_milliseconds integer NOT NULL
7070
)
7171
```

sql/pg_net.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ create unlogged table net.http_request_queue(
1313
id bigserial,
1414
method net.http_method not null,
1515
url text not null,
16-
headers jsonb not null,
16+
headers jsonb,
1717
body bytea,
1818
timeout_milliseconds int not null
1919
);

test/test_http_get_collect.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,27 @@ def test_http_get_ipv6(sess):
174174

175175
assert response is not None
176176
assert "Hello ipv6 only" in response[2]
177+
178+
179+
def test_http_get_null_headers(sess):
180+
"""net.http_get can have null headers"""
181+
182+
(request_id,) = sess.execute(text(
183+
"""
184+
select net.http_get('http://localhost:8080', null::jsonb, null::jsonb, 100);
185+
"""
186+
)).fetchone()
187+
188+
sess.commit()
189+
190+
response = sess.execute(
191+
text(
192+
"""
193+
select * from net._http_collect_response(:request_id, async:=false);
194+
"""
195+
),
196+
{"request_id": request_id},
197+
).fetchone()
198+
199+
assert response is not None
200+
assert "Hello world" in response[2]

0 commit comments

Comments
 (0)