// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://fetch.spec.whatwg.org/#request-class

typedef (Request or USVString) RequestInfo;

enum RequestMode { "navigate", "same-origin", "no-cors", "cors" };
enum RequestCredentials { "omit", "same-origin", "include" };
enum RequestRedirect { "follow", "error", "manual" };
enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", 
    "only-if-cached" };

// https://w3c.github.io/webappsec-referrer-policy/#referrer-policies

enum ReferrerPolicy {
    "",
    "no-referrer",
    "no-referrer-when-downgrade",
    "origin",
    "origin-when-cross-origin",
    "unsafe-url"
};

[
    ActiveScriptWrappable,
    Constructor(RequestInfo input, optional Dictionary requestInitDict),
    ConstructorCallWith=ScriptState,
    Exposed=(Window,Worker),
    RaisesException=Constructor,
    DependentLifetime
] interface Request {
    readonly attribute ByteString method;
    readonly attribute USVString url;
    [ImplementedAs=getHeaders] readonly attribute Headers headers;
    readonly attribute DOMString referrer;
    [ImplementedAs=getReferrerPolicy] readonly attribute ReferrerPolicy referrerPolicy;
    readonly attribute RequestMode mode;
    readonly attribute RequestCredentials credentials;
    [RuntimeEnabled=FetchRequestCache]readonly attribute RequestCache cache;
    readonly attribute RequestRedirect redirect;
    readonly attribute DOMString integrity;

    [RaisesException, CallWith=ScriptState] Request clone();
};

Request implements Body;
