@@ -26,11 +26,12 @@ const Page = @import("../page.zig").Page;
2626const Http = @import ("../../http/Http.zig" );
2727const HttpClient = @import ("../../http/Client.zig" );
2828const Mime = @import ("../mime.zig" ).Mime ;
29+ const Headers = @import ("Headers.zig" );
2930
3031const RequestInput = @import ("Request.zig" ).RequestInput ;
3132const RequestInit = @import ("Request.zig" ).RequestInit ;
3233const Request = @import ("Request.zig" );
33- const Response = @import ("./ Response.zig" );
34+ const Response = @import ("Response.zig" );
3435
3536pub const Interfaces = .{
3637 @import ("Headers.zig" ),
@@ -56,11 +57,22 @@ const FetchContext = struct {
5657 /// We just return the underlying slices used for `headers`
5758 /// and for `body` here to avoid an allocation.
5859 pub fn toResponse (self : * const FetchContext ) ! Response {
60+ var headers : Headers = .{};
61+
62+ // convert into Headers
63+ for (self .headers .items ) | hdr | {
64+ var iter = std .mem .splitScalar (u8 , hdr , ':' );
65+ const name = iter .next () orelse "" ;
66+ const value = iter .next () orelse "" ;
67+ try headers .append (name , value , self .arena );
68+ }
69+
5970 return Response {
6071 .status = self .status ,
61- .headers = self . headers . items ,
72+ .headers = headers ,
6273 .mime = self .mime ,
6374 .body = self .body .items ,
75+ .url = self .url ,
6476 };
6577 }
6678};
0 commit comments