Skip to content

Commit

Permalink
Small changes after type definitions are added
Browse files Browse the repository at this point in the history
Once https-proxy-agent type definitions are added,
these changes will be necessary to make this sample work.

The PR that introduces the TypeScript definitions to https-proxy-agent
is:
TooTallNate/proxy-agents#66

This commit is related to
#3064
  • Loading branch information
sadasant committed May 21, 2019
1 parent be693fc commit ed7bef0
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -10,16 +10,21 @@ import { ServiceBusClient } from "@azure/service-bus";
import WebSocket from "ws";
import url from "url";
import httpsProxyAgent from "https-proxy-agent";
import { HttpsProxyAgentOptions } from "https-proxy-agent";

// Define connection string for your Service Bus instance here
const connectionString = "";

// Get relevant proxy url, username and password needed to create an instance of httpsProxyAgent
const urlParts = url.parse("http://localhost:3128");
urlParts.auth = "username:password"; // Skip this if proxy server does not need authentication.
const { host = "", port = "" } = url.parse("http://localhost:3128");
const options: HttpsProxyAgentOptions = {
host,
port: parseInt(port, 10),
auth: "username:password" // Skip this if proxy server does not need authentication.
}

// Create an instance of the `HttpsProxyAgent` class with the proxy server information
const proxyAgent = new httpsProxyAgent(urlParts);
const proxyAgent = new httpsProxyAgent(options);

async function main(): Promise<void> {
const sbClient = ServiceBusClient.createFromConnectionString(connectionString, {
Expand Down

0 comments on commit ed7bef0

Please sign in to comment.