How to use the @azure/ms-rest-js.URLBuilder.parse function in @azure/ms-rest-js

To help you get started, we’ve selected a few @azure/ms-rest-js 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-file / src / utils / utils.common.ts View on Github external
export function getURLQueries(url: string): { [key: string]: string } {
  let queryString = URLBuilder.parse(url).getQuery();
  if (!queryString) {
    return {};
  }

  queryString = queryString.trim();
  queryString = queryString.startsWith("?") ? queryString.substr(1) : queryString;

  let querySubStrings: string[] = queryString.split("&");
  querySubStrings = querySubStrings.filter((value: string) => {
    const indexOfEqual = value.indexOf("=");
    const lastIndexOfEqual = value.lastIndexOf("=");
    return (
      indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual
    );
  });
github Azure / azure-sdk-for-js / sdk / storage / storage-file / 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-file / src / 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-file / 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-storage-js / queue / lib / 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-storage-js / queue / lib / 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-storage-js / queue / lib / 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-file / src / utils / utils.common.ts View on Github external
export function appendToURLPath(url: string, name: string): string {
  const urlParsed = URLBuilder.parse(url);

  let path = urlParsed.getPath();
  path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name;
  urlParsed.setPath(path);

  return urlParsed.toString();
}
github Azure / azure-storage-js / queue / lib / utils / utils.common.ts View on Github external
export function appendToURLPath(url: string, name: string): string {
  const urlParsed = URLBuilder.parse(url);

  let path = urlParsed.getPath();
  path = path
    ? path.endsWith("/")
      ? `${path}${name}`
      : `${path}/${name}`
    : name;
  urlParsed.setPath(path);

  return urlParsed.toString();
}
github Azure / azure-sdk-for-js / sdk / storage / storage-file / 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);
}