mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: In order to create a `HTTPResponseStatus` value from an status code code currently one would have to make a custom HTTPResponseStatus. The problem with that is that: `HTTPResponseStatus.custom(code: 200, reasonPhrase: "") != HTTPResponseStatus.ok` The logic of detecting whether a status code matches one of the known cases already exists but only in an internal factory method. Modifications: - removed internal static `from` method from `HTTPResponseStatus` - added public init with the functionality previously in `from` - replace the single use of the `from` method with the new `init` Result: When initializing a `HTTPResponseStatus` value with a value of e.g. `200` the init method will result in a `HTTPResponseStatus.ok`.