POSTResource.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteBuffer.h>
  8. #include <AK/String.h>
  9. #include <AK/StringView.h>
  10. #include <AK/Vector.h>
  11. namespace Web::HTML {
  12. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#post-resource
  13. struct POSTResource {
  14. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#post-resource-request-body
  15. // A request body, a byte sequence or failure.
  16. // FIXME: Change type to hold failure state.
  17. Optional<ByteBuffer> request_body;
  18. enum class RequestContentType {
  19. ApplicationXWWWFormUrlencoded,
  20. MultipartFormData,
  21. TextPlain,
  22. };
  23. // https://html.spec.whatwg.org/multipage/browsing-the-web.html#post-resource-request-content-type
  24. // A request content-type, which is `application/x-www-form-urlencoded`, `multipart/form-data`, or `text/plain`.
  25. RequestContentType request_content_type {};
  26. struct Directive {
  27. StringView type;
  28. String value;
  29. };
  30. Vector<Directive> request_content_type_directives {};
  31. };
  32. }