mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
zig fmt
This commit is contained in:
@@ -243,7 +243,7 @@ pub fn getOrigin(allocator: Allocator, raw: [:0]const u8) !?[]const u8 {
|
||||
const scheme_end = std.mem.indexOf(u8, raw, "://") orelse return null;
|
||||
|
||||
// Only HTTP and HTTPS schemes have origins
|
||||
const protocol = raw[0..scheme_end + 1];
|
||||
const protocol = raw[0 .. scheme_end + 1];
|
||||
if (!std.mem.eql(u8, protocol, "http:") and !std.mem.eql(u8, protocol, "https:")) {
|
||||
return null;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ pub fn getOrigin(allocator: Allocator, raw: [:0]const u8) !?[]const u8 {
|
||||
// Check for port in the host:port section
|
||||
const host_part = raw[authority_start..authority_end];
|
||||
if (std.mem.lastIndexOfScalar(u8, host_part, ':')) |colon_pos_in_host| {
|
||||
const port = host_part[colon_pos_in_host + 1..];
|
||||
const port = host_part[colon_pos_in_host + 1 ..];
|
||||
|
||||
// Validate it's actually a port (all digits)
|
||||
for (port) |c| {
|
||||
|
||||
@@ -144,7 +144,6 @@ fn httpErrorCallback(ctx: *anyopaque, err: anyerror) void {
|
||||
self._resolver.reject("fetch error", @errorName(err));
|
||||
}
|
||||
|
||||
|
||||
const testing = @import("../../../testing.zig");
|
||||
test "WebApi: fetch" {
|
||||
try testing.htmlRunner("net/fetch.html", .{});
|
||||
|
||||
@@ -59,7 +59,7 @@ const Credentials = enum {
|
||||
const Cache = enum {
|
||||
default,
|
||||
@"no-store",
|
||||
@"reload",
|
||||
reload,
|
||||
@"no-cache",
|
||||
@"force-cache",
|
||||
@"only-if-cached",
|
||||
|
||||
@@ -113,7 +113,6 @@ pub fn isOK(self: *const Response) bool {
|
||||
return self._status >= 200 and self._status <= 299;
|
||||
}
|
||||
|
||||
|
||||
pub fn getText(self: *const Response, page: *Page) !js.Promise {
|
||||
const body = self._body orelse "";
|
||||
return page.js.resolvePromise(body);
|
||||
|
||||
Reference in New Issue
Block a user