Import std.net.http.headers
std.net.http.headers
HTTP header fields, whose names match in any letter case.
Headers, an HTTP request's or response's header fields: names, which ASCII's letter cases don't change, as "Content-Type" and "content-type" are one, each with its values, in the order they were added.
std/net/http/headers.fb
Types
Headers
class
Public Class Headers Implements Iterable<(String, String)>, Cloneable, Printable
A request's or a response's header fields, as names and values. A name keeps the letter cases it was given, and finds every value of it in any.
Examples
Local headers = Headers()
headers.Add("Set-Cookie", "a=1")
headers.Add("set-cookie", "b=2")
headers.Set("Content-Type", "text/html")
Expect(headers.Get("content-type") == "text/html")
Expect(headers.GetAll("SET-COOKIE") == ["a=1", "b=2"])
Expect(headers.Count == 3)std/net/http/headers.fb, line 30
-
How many fields it has: each name and value.
-
Adds a value for
name, after any it has. Panics whennameisn't a header's name, a token of letters, digits, and !#$%&'*+-.^_|~, orvalue` has a control character other than a tab, as a line break would make it another header. -
Gives
nameonlyvalue, where its first one was, or last when it had none. Panics as Add does. -
name's first value, or Null when it has none. -
Each of
name's values, in order. -
Whether it has a value of
name, whatever its letters' case. -
Takes out each of
name's values, and tells whether it had any. -
Takes every header out.
-
Each name and value, in order.
-
New Headers with the same names and values.
-
Each as "Name: value", or "Name:" for an empty value, a line each.
HeadersIterator
struct
Public Struct HeadersIterator Implements Iterator<(String, String)>
Headers' names and values, in order, as far as their Count when each is read.
std/net/http/headers.fb, line 153
-
The next field's name and value, in order, or Null after the last.
Report an issue with this page or with FutureBlitz on GitHub.