Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fingerprint crashes when o.data is a string #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 15, 2016

  1. fingerprint(o) crashes when o.data is a string

    new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.whitespace,
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        aprefetch: '',
        remote: {
            url: .....',
            prepare: function(query, settings) {
                settings.type = 'POST';
                settings.contentType = 'application/json; charset=UTF-8';
                // Data will go into POST request body, not querystring
                settings.data = JSON.stringify({ q: query });
                return settings;
            }
        }
    });
    In the above scenario, settings.data should go into the request body, not into querystring. The argument name-value pairs should be in JSON format (eg {"objName":"Value"}), not in querystring format (eg objName=Value).
    Therefore, we set settings.data = JSON.stringify({ q: query }); - a string value.
    However, this doesn't bode well for function fingerprint(o):
    
    $.param(o.data || {}) crashes because it does not expect a single string value.
    Esam Bdeir committed Nov 15, 2016
    Configuration menu
    Copy the full SHA
    7e31806 View commit details
    Browse the repository at this point in the history