Repository: vapor/vapor
File: Sources/Vapor/HTTP/Headers/HTTPCookies.swift (Swift)

Code before:
                }
                self.value.domain = .init(parameter)
            case "path":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.path = .init(parameter)
            case "expires":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.expires = Date(rfc1123: .init(parameter))
            case "httponly":
                self.value.isHTTPOnly = true
            case "secure":
                self.value.isSecure = true
            case "max-age":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.maxAge = Int(parameter) ?? 0
            case "samesite":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.sameSite = HTTPCookies.SameSitePolicy(rawValue: .init(parameter)) ?? .lax
            default:
                return nil
            }
        }
    }
}

/// A collection of `HTTPCookie`s.
public struct HTTPCookies: ExpressibleByDictionaryLiteral {
    /// A cookie which can only be sent in requests originating from the same origin as the target domain.
    ///
    /// This restriction mitigates attacks such as cross-site request forgery (XSRF).
    public enum SameSitePolicy: String {
        /// Strict mode.
        case strict = "Strict"
        /// Relaxed mode.
        case lax = "Lax"
        // Cookies marked SameSite=None should also be marked Secure.
        case none = "None"
    }
    
    /// A single cookie (key/value pair).
    public struct Value: ExpressibleByStringLiteral {
        // MARK: Static
        

Review comment (suggestion):
Again, I think we should still give people the option to set it to nil, and if we default to lax in the initialiser that should fix the underlying issue

Code after:
                }
                self.value.domain = .init(parameter)
            case "path":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.path = .init(parameter)
            case "expires":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.expires = Date(rfc1123: .init(parameter))
            case "httponly":
                self.value.isHTTPOnly = true
            case "secure":
                self.value.isSecure = true
            case "max-age":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.maxAge = Int(parameter) ?? 0
            case "samesite":
                guard let parameter = directive.parameter else {
                    return nil
                }
                self.value.sameSite = HTTPCookies.SameSitePolicy(rawValue: .init(parameter))
            default:
                return nil
            }
        }
    }
}

/// A collection of `HTTPCookie`s.
public struct HTTPCookies: ExpressibleByDictionaryLiteral {
    /// A cookie which can only be sent in requests originating from the same origin as the target domain.
    ///
    /// This restriction mitigates attacks such as cross-site request forgery (XSRF).
    public enum SameSitePolicy: String {
        /// Strict mode.
        case strict = "Strict"
        /// Relaxed mode.
        case lax = "Lax"
        // Cookies marked SameSite=None should also be marked Secure.
        case none = "None"
    }
    
    /// A single cookie (key/value pair).
    public struct Value: ExpressibleByStringLiteral {
        // MARK: Static