Skip to content

Commit fd7c536

Browse files
authored
feat: document the new --unix-socket flag for HTTP builtins (#2059)
* . * .
1 parent 5b85c3a commit fd7c536

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cookbook/http.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,19 @@ Available metadata:
292292
- `status` - HTTP status code (200, 404, 500, etc.)
293293
- `headers` - `[{name, value}, ...]`
294294
- `urls` - Redirect history
295+
296+
---
297+
298+
### Connecting via Unix Domain Sockets
299+
300+
You can connect to HTTP servers over Unix domain sockets using the `--unix-socket` flag. This works on Unix/Linux systems and Windows 10+ (build 17063 and later). This is commonly used for local services like the Docker daemon, systemd, or other IPC services.
301+
302+
```nu
303+
# Query Docker daemon via Unix socket
304+
http get --unix-socket /var/run/docker.sock http://localhost/containers/json
305+
306+
# The hostname in the URL populates the HTTP Host header
307+
http post --unix-socket ./my-service.sock http://api/endpoint {data: "value"}
308+
```
309+
310+
The socket path specifies where to connect, while the URL's hostname is used for the HTTP Host header.

0 commit comments

Comments
 (0)