method Response.headerAll
All values of the header with this name, in order.
Example:
use std.http { Response, Header }
fn sample() -> Response {
Response{
status: 200, reason: "OK", version: "1.1",
headers: [Header{ name: "Content-Type", value: "text/plain" }, Header{ name: "Set-Cookie", value: "a=1" }, Header{ name: "Set-Cookie", value: "b=2" }],
body: Utf8.encode("hello"), url: "http://example.org/", reused: false, redirects: 0
}
}
fn main() io {
print("{sample().headerAll("set-cookie")}")
}Вывод
["a=1", "b=2"]
pub(api) fn headerAll(name: str) -> List<str>Сложность. O(h) in the number of headers.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
name | str |
Возвращает
List<str>
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/http/http.oxl:279