-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix including proxy policy in browser (#328)
* Fix including proxy policy in browser * Add browser tests
- Loading branch information
Showing
8 changed files
with
149 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
import { ProxySettings } from "../serviceClient"; | ||
import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy"; | ||
import { HttpOperationResponse } from "../httpOperationResponse"; | ||
import { WebResource } from "../webResource"; | ||
|
||
const proxyNotSupportedInBrowser = new Error("ProxyPolicy is not supported in browser environment"); | ||
|
||
export function getDefaultProxySettings(_proxyUrl?: string): ProxySettings | undefined { | ||
return undefined; | ||
} | ||
|
||
export function proxyPolicy(_proxySettings?: ProxySettings): RequestPolicyFactory { | ||
return { | ||
create: (_nextPolicy: RequestPolicy, _options: RequestPolicyOptions) => { | ||
throw proxyNotSupportedInBrowser; | ||
} | ||
}; | ||
} | ||
|
||
export class ProxyPolicy extends BaseRequestPolicy { | ||
constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions) { | ||
super(nextPolicy, options); | ||
throw proxyNotSupportedInBrowser; | ||
} | ||
|
||
public sendRequest(_request: WebResource): Promise<HttpOperationResponse> { | ||
throw proxyNotSupportedInBrowser; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters