Skip to content

Commit 496a47c

Browse files
committed
Optional form enctype & method
1 parent 5d34920 commit 496a47c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Sources/SwiftHtml/Html/Tags/Form.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,18 @@ public extension Form {
7070
}
7171

7272
/// Specifies how the form-data should be encoded when submitting it to the server (only for method="post")
73-
func enctype(_ value: Enctype, _ condition: Bool = true) -> Self {
74-
if condition {
73+
func enctype(_ value: Enctype?, _ condition: Bool = true) -> Self {
74+
if let value = value, condition {
7575
node.upsert(Attribute(key: "enctype", value: value.rawValue))
7676
}
7777
return self
7878
}
7979

8080
/// Specifies the HTTP method to use when sending form-data
81-
func method(_ value: Method) -> Self {
82-
node.upsert(Attribute(key: "method", value: value.rawValue))
81+
func method(_ value: Method?) -> Self {
82+
if let value = value {
83+
node.upsert(Attribute(key: "method", value: value.rawValue))
84+
}
8385
return self
8486
}
8587

0 commit comments

Comments
 (0)