summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp
blob: 343279f1709c02cfcc6ab3e7abc9bbd59940cad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include "LoadRequest.h"
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Page/Page.h>

namespace Web {

LoadRequest LoadRequest::create_for_url_on_page(const URL& url, Page* page)
{
    LoadRequest request;
    request.set_url(url);

    if (page) {
        String cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http);
        if (!cookie.is_empty())
            request.set_header("Cookie", cookie);
    }

    return request;
}

}