mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
--uds option for binding to Unix domain socket, closes #1388
This commit is contained in:
parent
e0064ba7b0
commit
180c7a5328
6 changed files with 65 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import httpx
|
||||
import pytest
|
||||
import socket
|
||||
|
||||
|
||||
@pytest.mark.serial
|
||||
|
|
@ -21,3 +22,17 @@ def test_serve_localhost_https(ds_localhost_https_server):
|
|||
"path": "/_memory",
|
||||
"tables": [],
|
||||
}.items() <= response.json().items()
|
||||
|
||||
|
||||
@pytest.mark.serial
|
||||
@pytest.mark.skipif(not hasattr(socket, "AF_UNIX"), reason="Requires socket.AF_UNIX support")
|
||||
def test_serve_unix_domain_socket(ds_unix_domain_socket_server):
|
||||
_, uds = ds_unix_domain_socket_server
|
||||
transport = httpx.HTTPTransport(uds=uds)
|
||||
client = httpx.Client(transport=transport)
|
||||
response = client.get("http://localhost/_memory.json")
|
||||
assert {
|
||||
"database": "_memory",
|
||||
"path": "/_memory",
|
||||
"tables": [],
|
||||
}.items() <= response.json().items()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue