LibWeb/Fetch: Implement Body::bytes()

See:
- 1085f4f
This commit is contained in:
Jamie Mansfield 2024-05-19 12:29:26 +01:00 committed by Andreas Kling
commit 08e4cf1f3b
Notes: sideshowbarker 2024-07-16 22:22:13 +09:00
3 changed files with 22 additions and 0 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -16,6 +17,7 @@ namespace Web::Fetch {
enum class PackageDataType {
ArrayBuffer,
Blob,
Uint8Array,
FormData,
JSON,
Text,
@ -39,6 +41,7 @@ public:
// JS API functions
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> array_buffer() const;
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> blob() const;
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> bytes() const;
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> form_data() const;
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> json() const;
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> text() const;