From c86c2f456fc7ed089bbe831ee4f7590cba4751dd Mon Sep 17 00:00:00 2001 From: Kevin Wooten Date: Thu, 14 Nov 2024 15:55:21 -0700 Subject: [PATCH 1/2] Include YAML as a standard MediaType and structured --- Sources/Sunday/MediaType.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Sunday/MediaType.swift b/Sources/Sunday/MediaType.swift index ad0b464f..74bf573b 100644 --- a/Sources/Sunday/MediaType.swift +++ b/Sources/Sunday/MediaType.swift @@ -77,6 +77,7 @@ public struct MediaType { public static let xml = suffix("xml") public static let json = suffix("json") + public static let yaml = suffix("yaml") public static let ber = suffix("ber") public static let der = suffix("der") public static let fastinfoset = suffix("fastinfoset") @@ -208,7 +209,7 @@ public struct MediaType { public static let plain = MediaType(type: .text, subtype: "plain") public static let html = MediaType(type: .text, subtype: "html") public static let json = MediaType(type: .application, subtype: "json") - public static let yaml = MediaType(type: .application, subtype: "json") + public static let yaml = MediaType(type: .application, subtype: "yaml") public static let cbor = MediaType(type: .application, subtype: "cbor") public static let eventStream = MediaType(type: .text, subtype: "event-stream") public static let octetStream = MediaType(type: .application, subtype: "octet-stream") @@ -224,6 +225,7 @@ public struct MediaType { public static let x509UserCert = MediaType(type: .application, tree: .obsolete, subtype: "x509-user-cert") public static let jsonStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .json) + public static let yamlStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .yaml) public static let xmlStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .xml) } From 4c5ad6197e4734228f5484217f2893b0667ac389 Mon Sep 17 00:00:00 2001 From: Kevin Wooten Date: Thu, 14 Nov 2024 15:55:47 -0700 Subject: [PATCH 2/2] Add CBOR structured media type --- Sources/Sunday/MediaType.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Sunday/MediaType.swift b/Sources/Sunday/MediaType.swift index 74bf573b..689fc700 100644 --- a/Sources/Sunday/MediaType.swift +++ b/Sources/Sunday/MediaType.swift @@ -227,6 +227,7 @@ public struct MediaType { public static let jsonStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .json) public static let yamlStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .yaml) public static let xmlStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .xml) + public static let cborStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .cbor) }