File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -134,3 +134,68 @@ FROM
134
134
;
135
135
----
136
136
S2A_56LPN_20210930_0_L2A
137
+
138
+ # Confirm the POST function with form request works
139
+ query III
140
+ WITH __input AS (
141
+ SELECT
142
+ http_post_form(
143
+ 'https://httpbin.org/delay/0',
144
+ headers => MAP {
145
+ 'accept': 'application/json',
146
+ },
147
+ params => MAP {
148
+ 'limit': 10
149
+ }
150
+ ) AS res
151
+ ),
152
+ __response AS (
153
+ SELECT
154
+ (res->>'status')::INT AS status,
155
+ (res->>'reason') AS reason,
156
+ unnest( from_json(((res->>'body')::JSON)->'headers', '{"Host": "VARCHAR"}') ) AS features
157
+ FROM
158
+ __input
159
+ )
160
+ SELECT
161
+ __response.status,
162
+ __response.reason,
163
+ __response.Host AS host
164
+ FROM
165
+ __response
166
+ ;
167
+ ----
168
+ 200 OK httpbin.org
169
+
170
+ # Confirm the POST function with form encoding transmits a single value
171
+ query III
172
+ WITH __input AS (
173
+ SELECT
174
+ http_post_form(
175
+ 'https://httpbin.org/delay/0',
176
+ headers => MAP {
177
+ 'accept': 'application/json',
178
+ },
179
+ params => MAP {
180
+ 'limit': 10
181
+ }
182
+ ) AS res
183
+ ),
184
+ __response AS (
185
+ SELECT
186
+ (res->>'status')::INT AS status,
187
+ (res->>'reason') AS reason,
188
+ unnest( from_json(((res->>'body')::JSON)->'form', '{"limit": "VARCHAR"}') ) AS features
189
+ FROM
190
+ __input
191
+ )
192
+ SELECT
193
+ __response.status,
194
+ __response.reason,
195
+ __response.limit AS limit
196
+ FROM
197
+ __response
198
+ ;
199
+ ----
200
+ 200 OK 10
201
+
You can’t perform that action at this time.
0 commit comments