std.Uri: make scheme non-optional

This commit is contained in:
Andrew Kelley
2023-01-06 18:52:39 -07:00
parent 646a911c19
commit aa87789c29
2 changed files with 13 additions and 17 deletions

View File

@@ -735,10 +735,9 @@ pub fn connect(client: *Client, host: []const u8, port: u16, protocol: Connectio
}
pub fn request(client: *Client, uri: Uri, headers: Request.Headers, options: Request.Options) !Request {
const scheme = uri.scheme orelse return error.UnsupportedUrlScheme;
const protocol: Connection.Protocol = if (mem.eql(u8, scheme, "http"))
const protocol: Connection.Protocol = if (mem.eql(u8, uri.scheme, "http"))
.plain
else if (mem.eql(u8, scheme, "https"))
else if (mem.eql(u8, uri.scheme, "https"))
.tls
else
return error.UnsupportedUrlScheme;