1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_BodyExtractor_h
8 #define mozilla_dom_BodyExtractor_h
14 class nsIGlobalObject
;
19 class BodyExtractorBase
{
21 virtual nsresult
GetAsStream(nsIInputStream
** aResult
,
22 uint64_t* aContentLength
,
23 nsACString
& aContentTypeWithCharset
,
24 nsACString
& aCharset
) const = 0;
27 // The implementation versions of this template are:
28 // ArrayBuffer, ArrayBufferView, Blob, FormData,
29 // URLSearchParams, nsAString, Document, nsIInputStream.
30 template <typename Type
>
31 class BodyExtractor final
: public BodyExtractorBase
{
35 explicit BodyExtractor(Type
* aBody
) : mBody(aBody
) {}
37 nsresult
GetAsStream(nsIInputStream
** aResult
, uint64_t* aContentLength
,
38 nsACString
& aContentTypeWithCharset
,
39 nsACString
& aCharset
) const override
;
43 } // namespace mozilla
45 #endif // mozilla_dom_BodyExtractor_h