mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Implement formData()
for "multipart/form-data"
This commit is contained in:
parent
7ae46bf8b7
commit
8b097b38dd
Notes:
github-actions[bot]
2025-01-20 23:34:52 +00:00
Author: https://github.com/F3n67u
Commit: 8b097b38dd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3036
Reviewed-by: https://github.com/konradekk
Reviewed-by: https://github.com/tcl3 ✅
27 changed files with 1356 additions and 4 deletions
|
@ -8,6 +8,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
@ -23,6 +26,24 @@ enum class PackageDataType {
|
|||
Text,
|
||||
};
|
||||
|
||||
struct MultiPartFormDataHeader {
|
||||
Optional<String> name;
|
||||
Optional<String> filename;
|
||||
Optional<String> content_type;
|
||||
};
|
||||
|
||||
struct ContentDispositionHeader {
|
||||
String type;
|
||||
OrderedHashMap<String, String> parameters;
|
||||
};
|
||||
|
||||
struct MultipartParsingError {
|
||||
String message;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using MultipartParsingErrorOr = ErrorOr<T, MultipartParsingError>;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#body-mixin
|
||||
class BodyMixin {
|
||||
public:
|
||||
|
@ -49,5 +70,6 @@ public:
|
|||
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::Value> package_data(JS::Realm&, ByteBuffer, PackageDataType, Optional<MimeSniff::MimeType> const&);
|
||||
[[nodiscard]] WebIDL::ExceptionOr<GC::Ref<WebIDL::Promise>> consume_body(JS::Realm&, BodyMixin const&, PackageDataType);
|
||||
[[nodiscard]] MultipartParsingErrorOr<Vector<XHR::FormDataEntry>> parse_multipart_form_data(JS::Realm&, StringView input, MimeSniff::MimeType const& mime_type);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue