File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1111 *
1212 * @example Parsing a Dictionary (e.g., UCP-Agent header)
1313 * ```ts
14- * import { parseDictionary } from "@std/http/unstable-structured-fields";
14+ * import { isItem, parseDictionary } from "@std/http/unstable-structured-fields";
1515 * import { assertEquals } from "@std/assert";
1616 *
1717 * const header = 'profile="https://example.com/profile.json"';
1818 * const dict = parseDictionary(header);
19+ * const profile = dict.get("profile");
1920 *
20- * assertEquals(dict.get("profile")?.value, {
21- * type: "string",
22- * value: "https://example.com/profile.json",
23- * });
21+ * if (profile && isItem(profile)) {
22+ * assertEquals(profile.value, {
23+ * type: "string",
24+ * value: "https://example.com/profile.json",
25+ * });
26+ * }
2427 * ```
2528 *
2629 * @example Serializing a Dictionary
You can’t perform that action at this time.
0 commit comments