2022-09-21 23:14:40 +01:00
|
|
|
/*
|
2023-03-02 22:26:12 +00:00
|
|
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
2022-09-21 23:14:40 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
|
|
|
#include <AK/Variant.h>
|
|
|
|
#include <LibJS/Forward.h>
|
2025-07-19 19:35:33 -07:00
|
|
|
#include <LibWeb/Export.h>
|
2022-09-21 23:14:40 +01:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
namespace Web::Fetch {
|
|
|
|
|
2022-09-22 00:10:41 +01:00
|
|
|
// https://fetch.spec.whatwg.org/#bodyinit
|
2024-11-15 04:01:23 +13:00
|
|
|
using BodyInit = Variant<GC::Root<Streams::ReadableStream>, GC::Root<FileAPI::Blob>, GC::Root<WebIDL::BufferSource>, GC::Root<XHR::FormData>, GC::Root<DOMURL::URLSearchParams>, String>;
|
2022-09-22 00:10:41 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
using BodyInitOrReadableBytes = Variant<GC::Root<Streams::ReadableStream>, GC::Root<FileAPI::Blob>, GC::Root<WebIDL::BufferSource>, GC::Root<XHR::FormData>, GC::Root<DOMURL::URLSearchParams>, String, ReadonlyBytes>;
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API Infrastructure::BodyWithType safely_extract_body(JS::Realm&, BodyInitOrReadableBytes const&);
|
|
|
|
WEB_API WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm&, BodyInitOrReadableBytes const&, bool keepalive = false);
|
2022-09-22 00:04:06 +01:00
|
|
|
|
2022-09-21 23:14:40 +01:00
|
|
|
}
|