@@ -62,60 +62,64 @@ from http(('GET', 'https://httpbin.org/anything', NULL, 'application/json', '{"s
6262
6363-- DELETE
6464SELECT status,
65- content::json->'args' AS args,
65+ content::json->'args'->>'foo' AS args,
6666content::json->'url' AS url,
6767content::json->'method' AS method
6868FROM http_delete('https://httpbin.org/anything?foo=bar');
69- status | args | url | method
70- --------+------------------+----------------------------------------+----------
71- 200 | { +| "https://httpbin.org/anything?foo=bar" | "DELETE"
72- | "foo": "bar"+| |
73- | } | |
69+ status | args | url | method
70+ --------+------+----------------------------------------+----------
71+ 200 | bar | "https://httpbin.org/anything?foo=bar" | "DELETE"
72+ (1 row)
73+
74+ -- DELETE with payload
75+ SELECT status,
76+ content::json->'args'->>'foo' AS args,
77+ content::json->'url' AS url,
78+ content::json->'method' AS method,
79+ content::json->'data' AS data
80+ FROM http_delete('https://httpbin.org/anything?foo=bar', 'payload', 'text/plain');
81+ status | args | url | method | data
82+ --------+------+----------------------------------------+----------+-----------
83+ 200 | bar | "https://httpbin.org/anything?foo=bar" | "DELETE" | "payload"
7484(1 row)
7585
7686-- PUT
7787SELECT status,
7888content::json->'data' AS data,
79- content::json->'args' AS args,
89+ content::json->'args'->>'foo' AS args,
8090content::json->'url' AS url,
8191content::json->'method' AS method
8292FROM http_put('https://httpbin.org/anything?foo=bar','payload','text/plain');
83- status | data | args | url | method
84- --------+-----------+------------------+----------------------------------------+--------
85- 200 | "payload" | { +| "https://httpbin.org/anything?foo=bar" | "PUT"
86- | | "foo": "bar"+| |
87- | | } | |
93+ status | data | args | url | method
94+ --------+-----------+------+----------------------------------------+--------
95+ 200 | "payload" | bar | "https://httpbin.org/anything?foo=bar" | "PUT"
8896(1 row)
8997
9098-- PATCH
9199SELECT status,
92100content::json->'data' AS data,
93- content::json->'args' AS args,
101+ content::json->'args'->>'foo' AS args,
94102content::json->'url' AS url,
95103content::json->'method' AS method
96104FROM http_patch('https://httpbin.org/anything?foo=bar','{"this":"that"}','application/json');
97- status | data | args | url | method
98- --------+-----------------------+------------------+----------------------------------------+---------
99- 200 | "{\"this\":\"that\"}" | { +| "https://httpbin.org/anything?foo=bar" | "PATCH"
100- | | "foo": "bar"+| |
101- | | } | |
105+ status | data | args | url | method
106+ --------+-----------------------+------+----------------------------------------+---------
107+ 200 | "{\"this\":\"that\"}" | bar | "https://httpbin.org/anything?foo=bar" | "PATCH"
102108(1 row)
103109
104110-- POST
105111SELECT status,
106112content::json->'data' AS data,
107- content::json->'args' AS args,
113+ content::json->'args'->>'foo' AS args,
108114content::json->'url' AS url,
109115content::json->'method' AS method
110116FROM http_post('https://httpbin.org/anything?foo=bar','payload','text/plain');
111- status | data | args | url | method
112- --------+-----------+------------------+----------------------------------------+--------
113- 200 | "payload" | { +| "https://httpbin.org/anything?foo=bar" | "POST"
114- | | "foo": "bar"+| |
115- | | } | |
117+ status | data | args | url | method
118+ --------+-----------+------+----------------------------------------+--------
119+ 200 | "payload" | bar | "https://httpbin.org/anything?foo=bar" | "POST"
116120(1 row)
117121
118- -- POST with data
122+ -- POST with json data
119123SELECT status,
120124content::json->'form'->>'this' AS args,
121125content::json->'url' AS url,
@@ -126,6 +130,18 @@ FROM http_post('https://httpbin.org/anything', jsonb_build_object('this', 'that'
126130 200 | that | "https://httpbin.org/anything" | "POST"
127131(1 row)
128132
133+ -- POST with data
134+ SELECT status,
135+ content::json->'form'->>'key1' AS key1,
136+ content::json->'form'->>'key2' AS key2,
137+ content::json->'url' AS url,
138+ content::json->'method' AS method
139+ FROM http_post('https://httpbin.org/anything', 'key1=value1&key2=value2','application/x-www-form-urlencoded');
140+ status | key1 | key2 | url | method
141+ --------+--------+--------+--------------------------------+--------
142+ 200 | value1 | value2 | "https://httpbin.org/anything" | "POST"
143+ (1 row)
144+
129145-- HEAD
130146SELECT lower(field) AS field, value
131147FROM (
0 commit comments