2022-09-21 23:14:40 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
|
|
|
|
#include <AK/Variant.h>
|
|
|
|
|
#include <LibJS/Forward.h>
|
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Fetch {
|
|
|
|
|
|
2022-09-22 00:10:41 +01:00
|
|
|
// https://fetch.spec.whatwg.org/#bodyinit
|
2022-12-04 18:02:33 +00:00
|
|
|
using BodyInit = Variant<JS::Handle<Streams::ReadableStream>, JS::Handle<FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<URL::URLSearchParams>, DeprecatedString>;
|
2022-09-22 00:10:41 +01:00
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
using BodyInitOrReadableBytes = Variant<JS::Handle<Streams::ReadableStream>, JS::Handle<FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<URL::URLSearchParams>, DeprecatedString, ReadonlyBytes>;
|
2022-11-09 22:37:07 +00:00
|
|
|
WebIDL::ExceptionOr<Infrastructure::BodyWithType> safely_extract_body(JS::Realm&, BodyInitOrReadableBytes const&);
|
|
|
|
|
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
|
|
|
}
|