How to use the @azure/core-http.URLBuilder.parse function in @azure/core-http

To help you get started, we’ve selected a few @azure/core-http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-js / sdk / storage / storage-utils / utils.common.ts View on Github external
export function getURLPathAndQuery(url: string): string | undefined {
  const urlParsed = URLBuilder.parse(url);
  const pathString = urlParsed.getPath();
  if (!pathString) {
    throw new RangeError("Invalid url without valid path.");
  }

  let queryString = urlParsed.getQuery() || "";
  queryString = queryString.trim();
  if (queryString != "") {
    queryString = queryString.startsWith("?") ? queryString : `?${queryString}`; // Ensure query string start with '?'
  }

  return `${pathString}${queryString}`;
}
github Azure / azure-sdk-for-js / sdk / storage / storage-queue / src / utils / utils.common.ts View on Github external
export function getURLParameter(url: string, name: string): string | string[] | undefined {
  const urlParsed = URLBuilder.parse(url);
  return urlParsed.getQueryParameterValue(name);
}
github Azure / azure-sdk-for-js / sdk / storage / storage-utils / utils.common.ts View on Github external
export function getURLScheme(url: string): string | undefined {
  const urlParsed = URLBuilder.parse(url);
  return urlParsed.getScheme();
}
github Azure / azure-sdk-for-js / sdk / storage / storage-utils / utils.common.ts View on Github external
export function escapeURLPath(url: string): string {
  const urlParsed = URLBuilder.parse(url);

  let path = urlParsed.getPath();
  path = path || "/";

  path = escape(path);
  urlParsed.setPath(path);

  return urlParsed.toString();
}
github Azure / azure-sdk-for-js / sdk / storage / storage-queue / src / utils / utils.common.ts View on Github external
export function getURLPath(url: string): string | undefined {
  const urlParsed = URLBuilder.parse(url);
  return urlParsed.getPath();
}
github Azure / azure-sdk-for-js / sdk / storage / storage-utils / utils.common.ts View on Github external
export function getURLParameter(url: string, name: string): string | string[] | undefined {
  const urlParsed = URLBuilder.parse(url);
  return urlParsed.getQueryParameterValue(name);
}
github Azure / azure-sdk-for-js / sdk / storage / storage-utils / utils.common.ts View on Github external
export function setURLParameter(url: string, name: string, value?: string): string {
  const urlParsed = URLBuilder.parse(url);
  urlParsed.setQueryParameter(name, value);
  return urlParsed.toString();
}
github Azure / azure-sdk-for-js / sdk / storage / storage-file-share / src / utils / utils.common.ts View on Github external
export function setURLHost(url: string, host: string): string {
  const urlParsed = URLBuilder.parse(url);
  urlParsed.setHost(host);
  return urlParsed.toString();
}
github Azure / azure-sdk-for-js / sdk / storage / storage-file-share / src / utils / utils.common.ts View on Github external
export function getURLParameter(url: string, name: string): string | string[] | undefined {
  const urlParsed = URLBuilder.parse(url);
  return urlParsed.getQueryParameterValue(name);
}