Technology Evaluation - URL parsing

From wiki.gpii
Jump to: navigation, search


In recent work within the community, many of us have moved away from using request-handling libraries in favor of the DataSource concept introduce in kettle. When interacting with REST APIs from Node, many of us have used the kettle.dataSource.URL grade, whose implementation is backed by the "http.request" method provided by Node itself. We have been working to create a browser equivalent of kettle.dataSource.URL. This requires us to find cross-environment alternatives for the node-specific approaches currently used.

One key point we discussed is URL parsing.


The current kettle.dataSource.URL implementation uses Node's URL module directly. On the client-side, many of us directly use and rely on the URL parsing built into jQuery.ajax.


Long term, we need an approach that:

  1. Works in all browsers
  2. Works in node
  3. Provides all the information we need, and in the right format, to launch the underlying request mechanism
  4. Ideally, is based on a standard.
  5. Is compatible with our way of working:
    1. It should be possible to build a series of simple reusable components using the library.
    2. It should not require us to support additional technologies for either the code or tests.


The WhatWG URL Standard is a living standard that builds on earlier work, including that of the related W3C working group. It is actively maintained and there are implementations for both node and browsers.

Candidate Approaches

Browserify and Node Modules

In early testing, we used Browserify to make a browser version of Node's URL module (and several other required modules). Although this worked for testing purposes, the resulting Javascript is very large, and is not based on a standard.

new URL()

Ideally, we would love to use a javascript-native approach like the Javascript URL API. Unfortunately, as of February 2017, this is currently not supported at all in Internet Explorer. Although this is standard within supporting browsers, it is not available within Node.

Libraries that Follow the WhatWG Spec

After searching Google and npm, I identified two libraries that provide WhatWG compliant URL parsing, and that at least at face value appear to work cross-environment.


The next step is to evaluate each of these.