Skip to content

Commit f8c7724

Browse files
committed
.
1 parent 8ceb1fc commit f8c7724

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

book/metadata.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,11 @@ You can attach arbitrary metadata to pipeline data using the [`metadata set`](/c
4848

4949
## HTTP Response Metadata
5050

51-
All HTTP commands attach response metadata (status, headers, redirect history):
51+
All HTTP commands attach response metadata:
5252

5353
```nu
5454
http get https://api.example.com | metadata | get http_response.status
5555
# => 200
5656
```
5757

58-
To work with metadata while streaming the response body, use [`metadata access`](/commands/docs/metadata_access.md):
59-
60-
```nu
61-
http get https://api.example.com/large-file
62-
| metadata access {|meta|
63-
print $"Status: ($meta.http_response.status)"
64-
if $meta.http_response.status != 200 {
65-
error make {msg: "Request failed"}
66-
} else { }
67-
}
68-
| lines # body streams through
69-
| each {|line| process $line }
70-
```
71-
72-
Without `metadata access`, you'd need `--full` to get metadata, which consumes the entire response body and prevents streaming. With `metadata access`, the body continues streaming through the pipeline.
73-
74-
Metadata structure:
75-
76-
- `status` - HTTP status code (200, 404, 500, etc.)
77-
- `headers` - Response headers as `[{name, value}, ...]`
78-
- `urls` - Redirect history
58+
For working with metadata while streaming response bodies, see the [HTTP cookbook](/cookbook/http.html#accessing-http-response-metadata-while-streaming).

0 commit comments

Comments
 (0)