-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to create a custom data type (#121)
* feat: Add option to create a custom data type * doc: Update README.md * fix: Apply PR suggestions
- Loading branch information
1 parent
f887c0e
commit 5d86f27
Showing
4 changed files
with
56 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// Mock+DataType.swift | ||
// Mocker | ||
// | ||
// Created by Weiß, Alexander on 26.07.22. | ||
// Copyright © 2022 WeTransfer. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Mock { | ||
/// The types of content of a request. Will be used as Content-Type header inside a `Mock`. | ||
public struct DataType { | ||
|
||
/// Name of the data type. | ||
public let name: String | ||
|
||
/// The header value of the data type. | ||
public let headerValue: String | ||
|
||
public init(name: String, headerValue: String) { | ||
self.name = name | ||
self.headerValue = headerValue | ||
} | ||
} | ||
} | ||
|
||
extension Mock.DataType { | ||
public static let json = Mock.DataType(name: "json", headerValue: "application/json; charset=utf-8") | ||
public static let html = Mock.DataType(name: "html", headerValue: "text/html; charset=utf-8") | ||
public static let imagePNG = Mock.DataType(name: "imagePNG", headerValue: "image/png") | ||
public static let pdf = Mock.DataType(name: "pdf", headerValue: "application/pdf") | ||
public static let mp4 = Mock.DataType(name: "mp4", headerValue: "video/mp4") | ||
public static let zip = Mock.DataType(name: "zip", headerValue: "application/zip") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters