1 |
|
2 |
|
3 |
|
4 | import { AgentSettings } 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 agentNotSupportedInBrowser = new Error("AgentPolicy is not supported in browser environment");
|
15 |
|
16 | export function agentPolicy(_agentSettings?: AgentSettings): RequestPolicyFactory {
|
17 | return {
|
18 | create: (_nextPolicy: RequestPolicy, _options: RequestPolicyOptionsLike) => {
|
19 | throw agentNotSupportedInBrowser;
|
20 | },
|
21 | };
|
22 | }
|
23 |
|
24 | export class AgentPolicy extends BaseRequestPolicy {
|
25 | constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptionsLike) {
|
26 | super(nextPolicy, options);
|
27 | throw agentNotSupportedInBrowser;
|
28 | }
|
29 |
|
30 | public sendRequest(_request: WebResourceLike): Promise<HttpOperationResponse> {
|
31 | throw agentNotSupportedInBrowser;
|
32 | }
|
33 | }
|