You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/2.0/rfc-usage.md
+16-15Lines changed: 16 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,13 @@ title: RFC Usage
5
5
6
6
# RFC Usage
7
7
8
+
The IETF RFC defines two algorithms regarding HTTP headers and trailers, one to parse them and
9
+
another one to serialize them.
10
+
8
11
## Parsing a field
9
12
10
-
The first way to use the package is to enable HTTP header or HTTP trailer parsing. We will refer to them
11
-
as HTTP fields for the rest of the documentation as it is how they are named in the IETF RFC.
13
+
The package enabled HTTP header or HTTP trailer parsing. We will refer to them as HTTP fields
14
+
for the rest of the documentation as it is how they are named in the IETF RFC.
12
15
13
16
Let's say we want to parse the [Permissions-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#syntax) field. The first thing to know
14
17
is that each structured field is defined against one specific data type which is
@@ -32,7 +35,7 @@ using the container public API:
32
35
$permissions['picture-in-picture']->isEmpty(); // returns true because the list is empty
33
36
count($permissions['geolocation']); // returns 2 the 'geolocation' feature has 2 values associated to it via a list
34
37
$permissions['geolocation'][-1]->value(); // returns the last value of the list 'https://example.com/'
35
-
$permissions['camera']->value(); // returns '*' the sole value attached to the 'camera' feature
38
+
$permissions['camera']->value()->toString(); // returns '*' the sole value attached to the 'camera' feature
36
39
isset($permissions['yolo']); // returns false this permission does not exust
37
40
$permissions->isEmpty(); // returns false the dictionary contains some permissions
0 commit comments