Skip to content

Commit

Permalink
Merge pull request #54 from outfoxx/feature/media-type-up
Browse files Browse the repository at this point in the history
Enhance `MediaType` to include YAML and fill out CBOR and others
  • Loading branch information
kdubb authored Nov 14, 2024
2 parents 69eabdd + 4c5ad61 commit 2f804f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/Sunday/MediaType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -224,7 +225,9 @@ 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)
public static let cborStructured = MediaType(type: .any, tree: .any, subtype: "*", suffix: .cbor)

}

Expand Down

0 comments on commit 2f804f0

Please sign in to comment.