You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The _http_collect_response was never meant to be used by end users. It
only was meant as an internal function for testing.
Why? Because it uses an endless loop (net._await_response) which is not
safe when running inside a transaction.
Previously it was removed from
https://supabase.com/docs/guides/database/extensions/pg_net
For the same reason.
If there's a need for sync requests, the current recommendation
is to use pgsql-http.
Copy file name to clipboardExpand all lines: README.md
+2-42Lines changed: 2 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,43 +166,6 @@ After saving the file, you can execute `SELECT pg_reload_conf()` to update _post
166
166
167
167
# Requests API
168
168
169
-
## Monitoring Requests
170
-
171
-
When you call a request function (http_get, http_post, http_delete), the function will return a request_id immediately. You can use this request_id with the net.\_http_collect_response function to check the results of your request. This function returns a custom type \_net.http_response_result\* that has three columns:
172
-
173
-
1.**response**: This is an aggregate of the response's status_code (integer), headers (JSONB), and body (text).
174
-
2.**status**: This value indicates the execution status of the request itself, which can be either 'PENDING', 'SUCCESS', or 'ERROR'. It's important not to confuse this status with the HTTP status code of the response (like 200 for 'OK', 404 for 'Not Found', etc.) that is found in the response column
175
-
3.**message**: This contains the response's message as text.
176
-
177
-
#### Observing a Request's Response
178
-
179
-
```sql
180
-
SELECT
181
-
message,
182
-
response,
183
-
status
184
-
FROM
185
-
net._http_collect_response(<response_id>);
186
-
```
187
-
188
-
> WARNING: Although the status column can be 'PENDING', 'SUCCESS', or 'ERROR', there is a bug that makes all 'PENDING' requests displayed as 'ERROR'.
189
-
190
-
The individual values within the response column can be extracted as shown in the following SQL query:
191
-
192
-
#### Extracting response values
193
-
194
-
```sql
195
-
SELECT
196
-
*,
197
-
(response).status_code,
198
-
(response).headers,
199
-
(response).body
200
-
-- Individual headers and values from the body can be extracted
201
-
(((response).body::JSON)->'key-from-json-body') AS some_value
202
-
FROM
203
-
net._http_collect_response(<request_id>);
204
-
```
205
-
206
169
## GET requests
207
170
208
171
### net.http_get function signature
@@ -241,11 +204,8 @@ SELECT net.http_get (
241
204
> NOTE: You can view the response with the following query:
0 commit comments