1 |
|
2 |
|
3 |
|
4 | import { ProxySettings } from "../serviceClient";
|
5 | import {
|
6 | BaseRequestPolicy,
|
7 | RequestPolicy,
|
8 | RequestPolicyFactory,
|
9 | RequestPolicyOptionsLike,
|
10 | } from "./requestPolicy";
|
11 | import { HttpOperationResponse } from "../httpOperationResponse";
|
12 | import { WebResourceLike } from "../webResource";
|
13 |
|
14 | const proxyNotSupportedInBrowser = new Error("ProxyPolicy is not supported in browser environment");
|
15 |
|
16 | export function getDefaultProxySettings(_proxyUrl?: string): ProxySettings | undefined {
|
17 | return undefined;
|
18 | }
|
19 |
|
20 | export function proxyPolicy(_proxySettings?: ProxySettings): RequestPolicyFactory {
|
21 | return {
|
22 | create: (_nextPolicy: RequestPolicy, _options: RequestPolicyOptionsLike) => {
|
23 | throw proxyNotSupportedInBrowser;
|
24 | },
|
25 | };
|
26 | }
|
27 |
|
28 | export 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 | }
|