proxyPolicy.browser.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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. import { ProxySettings } from "../serviceClient";
  4. import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy";
  5. import { HttpOperationResponse } from "../httpOperationResponse";
  6. import { WebResource } from "../webResource";
  7. const proxyNotSupportedInBrowser = new Error("ProxyPolicy is not supported in browser environment");
  8. export function getDefaultProxySettings(_proxyUrl?: string): ProxySettings | undefined {
  9. return undefined;
  10. }
  11. export function proxyPolicy(_proxySettings?: ProxySettings): RequestPolicyFactory {
  12. return {
  13. create: (_nextPolicy: RequestPolicy, _options: RequestPolicyOptions) => {
  14. throw proxyNotSupportedInBrowser;
  15. }
  16. };
  17. }
  18. export class ProxyPolicy extends BaseRequestPolicy {
  19. constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions) {
  20. super(nextPolicy, options);
  21. throw proxyNotSupportedInBrowser;
  22. }
  23. public sendRequest(_request: WebResource): Promise<HttpOperationResponse> {
  24. throw proxyNotSupportedInBrowser;
  25. }
  26. }