UNPKG

1.23 kBPlain TextView Raw
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License. See License.txt in the project root for license information.
3
4import { ProxySettings } from "../serviceClient";
5import {
6 BaseRequestPolicy,
7 RequestPolicy,
8 RequestPolicyFactory,
9 RequestPolicyOptionsLike,
10} from "./requestPolicy";
11import { HttpOperationResponse } from "../httpOperationResponse";
12import { WebResourceLike } from "../webResource";
13
14const proxyNotSupportedInBrowser = new Error("ProxyPolicy is not supported in browser environment");
15
16export function getDefaultProxySettings(_proxyUrl?: string): ProxySettings | undefined {
17 return undefined;
18}
19
20export function proxyPolicy(_proxySettings?: ProxySettings): RequestPolicyFactory {
21 return {
22 create: (_nextPolicy: RequestPolicy, _options: RequestPolicyOptionsLike) => {
23 throw proxyNotSupportedInBrowser;
24 },
25 };
26}
27
28export class ProxyPolicy extends BaseRequestPolicy {
29 constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptionsLike) {
30 super(nextPolicy, options);
31 throw proxyNotSupportedInBrowser;
32 }
33
34 public sendRequest(_request: WebResourceLike): Promise<HttpOperationResponse> {
35 throw proxyNotSupportedInBrowser;
36 }
37}