Skip to content

Commit

Permalink
Add test for timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Nov 8, 2018
1 parent 2ef7148 commit 9b9fe36
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions expected/http.out
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,17 @@ SELECT status FROM http_get('http://httpbin.org/status/555');
555
(1 row)

-- Alter the default timeout and then run a query that is longer than
-- the default (5s), but shorter than the new timeout
SELECT http_set_curlopt('CURLOPT_TIMEOUT_MS', '10000');
http_set_curlopt
------------------
t
(1 row)

SELECT status FROM http_get('http://httpstat.us/200?sleep=7000');
status
--------
200
(1 row)

4 changes: 4 additions & 0 deletions sql/http.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ SELECT http_reset_curlopt();
-- Now it should work
SELECT status FROM http_get('http://httpbin.org/status/555');

-- Alter the default timeout and then run a query that is longer than
-- the default (5s), but shorter than the new timeout
SELECT http_set_curlopt('CURLOPT_TIMEOUT_MS', '10000');
SELECT status FROM http_get('http://httpstat.us/200?sleep=7000');

0 comments on commit 9b9fe36

Please sign in to comment.