-module(scrapbook@internal@http). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([construct_request/2]). -file("/home/norbert/projects/scrapbook/src/scrapbook/internal/http.gleam", 5). -spec construct_request(binary(), binary()) -> {ok, gleam@http@request:request(binary())} | {error, scrapbook@error:request_error()}. construct_request(Url, User_agent) -> gleam@result:'try'( gleam@result:replace_error( gleam@http@request:to(Url), {construction_error, Url} ), fun(Req) -> Req@1 = begin _pipe = Req, _pipe@1 = gleam@http@request:set_header( _pipe, <<"accept"/utf8>>, <<"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"/utf8>> ), _pipe@2 = gleam@http@request:set_header( _pipe@1, <<"accept-language"/utf8>>, <<"en-US,en;q=0.6"/utf8>> ), _pipe@3 = gleam@http@request:set_header( _pipe@2, <<"cache-control"/utf8>>, <<"max-age=0"/utf8>> ), _pipe@4 = gleam@http@request:set_header( _pipe@3, <<"sec-fetch-dest"/utf8>>, <<"document"/utf8>> ), _pipe@5 = gleam@http@request:set_header( _pipe@4, <<"sec-fetch-mode"/utf8>>, <<"navigate"/utf8>> ), _pipe@6 = gleam@http@request:set_header( _pipe@5, <<"sec-fetch-site"/utf8>>, <<"same-origin"/utf8>> ), _pipe@7 = gleam@http@request:set_header( _pipe@6, <<"sec-fetch-user"/utf8>>, <<"?1"/utf8>> ), _pipe@8 = gleam@http@request:set_header( _pipe@7, <<"sec-gpc"/utf8>>, <<"1"/utf8>> ), _pipe@9 = gleam@http@request:set_header( _pipe@8, <<"upgrade-insecure-requests"/utf8>>, <<"1"/utf8>> ), gleam@http@request:set_header( _pipe@9, <<"user-agent"/utf8>>, User_agent ) end, {ok, Req@1} end ).