How to use the @azure/core-http.stripRequest 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 / servicebus / service-bus / src / serviceBusAtomManagementClient.ts View on Github external
private buildSubscriptionResponse(response: HttpOperationResponse): SubscriptionResponse {
    try {
      const subscription = buildSubscription(response.parsedBody);
      const subscriptionResponse: SubscriptionResponse = Object.assign(subscription || {}, {
        _response: response
      });
      return subscriptionResponse;
    } catch (err) {
      log.warning("Failure parsing response from service - %0 ", err);
      throw new RestError(
        `Error occurred while parsing the response body - cannot form a subscription object using the response from the service.`,
        RestError.PARSE_ERROR,
        response.status,
        stripRequest(response.request),
        stripResponse(response)
      );
    }
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusAtomManagementClient.ts View on Github external
const subscription = buildSubscription(rawSubscriptionArray[i]);
        if (subscription) {
          subscriptions.push(subscription);
        }
      }
      const listSubscriptionsResponse: ListSubscriptionsResponse = Object.assign(subscriptions, {
        _response: response
      });
      return listSubscriptionsResponse;
    } catch (err) {
      log.warning("Failure parsing response from service - %0 ", err);
      throw new RestError(
        `Error occurred while parsing the response body - cannot form a list of subscriptions using the response from the service.`,
        RestError.PARSE_ERROR,
        response.status,
        stripRequest(response.request),
        stripResponse(response)
      );
    }
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusAtomManagementClient.ts View on Github external
private async getResource(
    name: string,
    serializer: AtomXmlSerializer
  ): Promise {
    const webResource: WebResource = new WebResource(this.getUrl(name), "GET");

    const response = await executeAtomXmlOperation(this, webResource, serializer);
    if (
      response.parsedBody == undefined ||
      (Array.isArray(response.parsedBody) && response.parsedBody.length == 0)
    ) {
      const err = new RestError(
        `The messaging entity "${name}" being requested cannot be found.`,
        "404",
        404,
        stripRequest(webResource),
        stripResponse(response)
      );
      throw err;
    }
    return response;
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / util / atomXmlHelper.ts View on Github external
const response: HttpOperationResponse = await serviceBusAtomManagementClient.sendRequest(
    webResource
  );

  log.httpAtomXml(`Received ATOM based HTTP response: ${response.bodyAsText}`);

  try {
    if (response.bodyAsText) {
      response.parsedBody = await parseXML(response.bodyAsText, { includeRoot: true });
    }
  } catch (err) {
    const error = new RestError(
      `Error occurred while parsing the response body - expected the service to return valid xml content.`,
      RestError.PARSE_ERROR,
      response.status,
      stripRequest(response.request),
      stripResponse(response)
    );
    log.warning("Error parsing response body from Service - %0", err);
    throw error;
  }

  return serializer.deserialize(response);
}
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusAtomManagementClient.ts View on Github external
private buildRuleResponse(response: HttpOperationResponse): RuleResponse {
    try {
      const rule = buildRule(response.parsedBody);
      const ruleResponse: RuleResponse = Object.assign(rule || {}, { _response: response });
      return ruleResponse;
    } catch (err) {
      log.warning("Failure parsing response from service - %0 ", err);
      throw new RestError(
        `Error occurred while parsing the response body - cannot form a rule object using the response from the service.`,
        RestError.PARSE_ERROR,
        response.status,
        stripRequest(response.request),
        stripResponse(response)
      );
    }
  }
}
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / serviceBusAtomManagementClient.ts View on Github external
private buildTopicResponse(response: HttpOperationResponse): TopicResponse {
    try {
      const topic = buildTopic(response.parsedBody);
      const topicResponse: TopicResponse = Object.assign(topic || {}, { _response: response });
      return topicResponse;
    } catch (err) {
      log.warning("Failure parsing response from service - %0 ", err);
      throw new RestError(
        `Error occurred while parsing the response body - cannot form a topic object using the response from the service.`,
        RestError.PARSE_ERROR,
        response.status,
        stripRequest(response.request),
        stripResponse(response)
      );
    }
  }