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
Copy file name to clipboardExpand all lines: nix/tests/expected/http.out
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
-- Test for http extension
2
2
-- Basic HTTP functionality tests
3
3
-- Test basic HTTP GET request
4
-
SELECT status FROM http_get('http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/get');
4
+
SELECT status FROM http_get('http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/get');
5
5
status
6
6
--------
7
7
200
@@ -11,7 +11,7 @@ SELECT status FROM http_get('http://' || (SELECT value FROM test_config WHERE ke
11
11
SELECT status, content_type
12
12
FROM http((
13
13
'GET',
14
-
'http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/headers',
14
+
'http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/headers',
15
15
ARRAY[http_header('User-Agent', 'pg_http_test')],
16
16
NULL,
17
17
NULL
@@ -23,7 +23,7 @@ FROM http((
23
23
24
24
-- Test HTTP POST request with JSON body
25
25
SELECT status FROM http_post(
26
-
'http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/post',
26
+
'http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/post',
27
27
'{"test": "data"}',
28
28
'application/json'
29
29
);
@@ -34,7 +34,7 @@ SELECT status FROM http_post(
34
34
35
35
-- Test HTTP PUT request
36
36
SELECT status FROM http_put(
37
-
'http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/put',
37
+
'http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/put',
38
38
'{"update": "data"}',
39
39
'application/json'
40
40
);
@@ -44,15 +44,15 @@ SELECT status FROM http_put(
44
44
(1 row)
45
45
46
46
-- Test HTTP DELETE request
47
-
SELECT status FROM http_delete('http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/delete');
47
+
SELECT status FROM http_delete('http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/delete');
48
48
status
49
49
--------
50
50
200
51
51
(1 row)
52
52
53
53
-- Test HTTP PATCH request
54
54
SELECT status FROM http_patch(
55
-
'http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/patch',
55
+
'http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/patch',
56
56
'{"patch": "data"}',
57
57
'application/json'
58
58
);
@@ -62,15 +62,15 @@ SELECT status FROM http_patch(
62
62
(1 row)
63
63
64
64
-- Test HTTP HEAD request
65
-
SELECT status FROM http_head('http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/get');
65
+
SELECT status FROM http_head('http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/get');
66
66
status
67
67
--------
68
68
200
69
69
(1 row)
70
70
71
71
-- Test response headers parsing
72
72
WITH response AS (
73
-
SELECT * FROM http_get('http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/response-headers?Content-Type=text/plain')
73
+
SELECT * FROM http_get('http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/response-headers?Content-Type=text/plain')
74
74
)
75
75
SELECT
76
76
status,
@@ -86,7 +86,7 @@ FROM response;
86
86
-- This should complete successfully with reasonable timeout
87
87
SELECT status FROM http((
88
88
'GET',
89
-
'http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/delay/1',
89
+
'http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/delay/1',
90
90
ARRAY[]::http_header[],
91
91
'application/json',
92
92
2000 -- 2 second timeout
@@ -97,7 +97,7 @@ SELECT status FROM http((
97
97
(1 row)
98
98
99
99
-- Test URL encoding
100
-
SELECT status FROM http_get('http://' || (SELECT value FROM test_config WHERE key = 'http_mock_host') || ':' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/anything?param=value%20with%20spaces&another=123');
100
+
SELECT status FROM http_get('http://localhost:' || (SELECT value FROM test_config WHERE key = 'http_mock_port') || '/anything?param=value%20with%20spaces&another=123');
Copy file name to clipboardExpand all lines: nix/tests/sql/http.sql
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -2,48 +2,48 @@
2
2
-- Basic HTTP functionality tests
3
3
4
4
-- Test basic HTTP GET request
5
-
SELECT status FROM http_get('http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/get');
5
+
SELECT status FROM http_get('http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/get');
6
6
7
7
-- Test HTTP GET with headers
8
8
SELECT status, content_type
9
9
FROM http((
10
10
'GET',
11
-
'http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/headers',
11
+
'http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/headers',
12
12
ARRAY[http_header('User-Agent', 'pg_http_test')],
13
13
NULL,
14
14
NULL
15
15
)::http_request);
16
16
17
17
-- Test HTTP POST request with JSON body
18
18
SELECT status FROM http_post(
19
-
'http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/post',
19
+
'http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/post',
20
20
'{"test": "data"}',
21
21
'application/json'
22
22
);
23
23
24
24
-- Test HTTP PUT request
25
25
SELECT status FROM http_put(
26
-
'http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/put',
26
+
'http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/put',
27
27
'{"update": "data"}',
28
28
'application/json'
29
29
);
30
30
31
31
-- Test HTTP DELETE request
32
-
SELECT status FROM http_delete('http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/delete');
32
+
SELECT status FROM http_delete('http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/delete');
33
33
34
34
-- Test HTTP PATCH request
35
35
SELECT status FROM http_patch(
36
-
'http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/patch',
36
+
'http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/patch',
37
37
'{"patch": "data"}',
38
38
'application/json'
39
39
);
40
40
41
41
-- Test HTTP HEAD request
42
-
SELECT status FROM http_head('http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/get');
42
+
SELECT status FROM http_head('http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/get');
43
43
44
44
-- Test response headers parsing
45
45
WITH response AS (
46
-
SELECT*FROM http_get('http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/response-headers?Content-Type=text/plain')
46
+
SELECT*FROM http_get('http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/response-headers?Content-Type=text/plain')
47
47
)
48
48
SELECT
49
49
status,
@@ -55,11 +55,11 @@ FROM response;
55
55
-- This should complete successfully with reasonable timeout
56
56
SELECT status FROM http((
57
57
'GET',
58
-
'http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/delay/1',
58
+
'http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/delay/1',
59
59
ARRAY[]::http_header[],
60
60
'application/json',
61
61
2000-- 2 second timeout
62
62
)::http_request);
63
63
64
64
-- Test URL encoding
65
-
SELECT status FROM http_get('http://'|| (SELECT value FROM test_config WHERE key ='http_mock_host') ||':'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/anything?param=value%20with%20spaces&another=123');
65
+
SELECT status FROM http_get('http://localhost:'|| (SELECT value FROM test_config WHERE key ='http_mock_port') ||'/anything?param=value%20with%20spaces&another=123');
0 commit comments