mitmproxy/tools/web/static/aa/js/analytics.js
/**
     * Parse a given URL into human-readable output
     *
     * @param {string}  rawUrl      A URL to check against
     * @param {string}  postData    POST data, if applicable
     *
     * @return {{provider: {name: string, key: string, type: string}, data: Array}}
     */
Parse a given URL into human-readable output
@param {string}  rawUrl      A URL to check against
@param {string}  postData    POST data, if applicable


Parse a given URL into human - readable output @param { string } rawUrl A URL to check against @param { string } postData POST data if applicable
parseUrl(rawUrl, postData = "")
    {
        let url = new URL(rawUrl),
            data = [],
            params = new URLSearchParams(url.search),
            postParams = this.parsePostData(postData);
        postParams.forEach((pair) => {
            params.append(pair[0], pair[1]);
        });
        for(let param of params)
        {
            let key = param[0],
                value = param[1],
                result = this.handleQueryParam(key, value);
            if(typeof result === "object") {
                data.push(result);
            }
        }
        let customData = this.handleCustom(url, params);
        if(typeof customData === "object" && customData !== null)
        {
            if(customData.length) {
                data = data.concat(customData);
            } else {
                data.push(customData);
            }
        }
        return {
            "provider": {
                "name":    this.name,
                "key":     this.key,
                "type":    this.type,
                "columns": this.columnMapping,
                "groups":  this.groups
            },
            "data": data
        };
    }
parseUrl ( rawUrl , postData = "" ) { let url = new URL ( rawUrl ) , data = [ ] , params = new URLSearchParams ( url . search ) , postParams = this . parsePostData ( postData ) ; postParams . forEach ( ( pair ) => { params . append ( pair [ 0 ] , pair [ 1 ] ) ; } ) ; for ( let param of params ) { let key = param [ 0 ] , value = param [ 1 ] , result = this . handleQueryParam ( key , value ) ; if ( typeof result === "object" ) { data . push ( result ) ; } } let customData = this . handleCustom ( url , params ) ; if ( typeof customData === "object" && customData !== null ) { if ( customData . length ) { data = data . concat ( customData ) ; } else { data . push ( customData ) ; } } return { "provider" : { "name" : this . name , "key" : this . key , "type" : this . type , "columns" : this . columnMapping , "groups" : this . groups } , "data" : data } ; }
Parse a given URL into human-readable output
 @param {string}  rawUrl      A URL to check against
 @param {string}  postData    POST data, if applicable
Parse a given URL into human - readable output @param { string } rawUrl A URL to check against @param { string } postData POST data if applicable
// Handle POST data first, if applicable (treat as query params)