mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
use page's headerForRequest with fetch and XHR
This commit is contained in:
@@ -64,7 +64,7 @@ pub fn init(input: Input, options: ?InitOpts, page: *Page) !js.Promise {
|
|||||||
if (request._headers) |h| {
|
if (request._headers) |h| {
|
||||||
try h.populateHttpHeader(page.call_arena, &headers);
|
try h.populateHttpHeader(page.call_arena, &headers);
|
||||||
}
|
}
|
||||||
try page.requestCookie(.{}).headersForRequest(page.arena, request._url, &headers);
|
try page.headersForRequest(page.arena, request._url, &headers);
|
||||||
|
|
||||||
if (comptime IS_DEBUG) {
|
if (comptime IS_DEBUG) {
|
||||||
log.debug(.http, "fetch", .{ .url = request._url });
|
log.debug(.http, "fetch", .{ .url = request._url });
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ pub fn send(self: *XMLHttpRequest, body_: ?[]const u8) !void {
|
|||||||
const http_client = page._session.browser.http_client;
|
const http_client = page._session.browser.http_client;
|
||||||
var headers = try http_client.newHeaders();
|
var headers = try http_client.newHeaders();
|
||||||
try self._request_headers.populateHttpHeader(page.call_arena, &headers);
|
try self._request_headers.populateHttpHeader(page.call_arena, &headers);
|
||||||
try page.requestCookie(.{}).headersForRequest(self._arena, self._url, &headers);
|
try page.headersForRequest(self._arena, self._url, &headers);
|
||||||
|
|
||||||
try http_client.request(.{
|
try http_client.request(.{
|
||||||
.ctx = self,
|
.ctx = self,
|
||||||
|
|||||||
Reference in New Issue
Block a user