Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance MediaType to include YAML and fill out CBOR and others #54

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading