How to use insomnia-xpath - 2 common examples

To help you get started, we’ve selected a few insomnia-xpath 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 Kong / insomnia / packages / insomnia-app / app / ui / components / codemirror / code-editor.js View on Github external
_prettifyXML(code) {
    if (this.props.updateFilter && this.state.filter) {
      try {
        const results = queryXPath(code, this.state.filter);
        code = `${results.map(r => r.outer).join('\n')}`;
      } catch (err) {
        // Failed to parse filter (that's ok)
        code = `${err.message}`;
      }
    }

    try {
      return vkBeautify.xml(code, this._indentChars());
    } catch (e) {
      // Failed to parse so just return original
      return code;
    }
  }
github Kong / insomnia / plugins / insomnia-plugin-response / index.js View on Github external
function matchXPath(bodyStr, query) {
  const results = queryXPath(bodyStr, query);

  if (results.length === 0) {
    throw new Error(`Returned no results: ${query}`);
  } else if (results.length > 1) {
    throw new Error(`Returned more than one result: ${query}`);
  }

  return results[0].inner;
}

insomnia-xpath

Query XML using XPath

Apache-2.0
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Popular insomnia-xpath functions