How to use the form-urlencoded.encode function in form-urlencoded

To help you get started, we’ve selected a few form-urlencoded 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 soundcloud / soundcloud-javascript / src / api.js View on Github external
additionalParams.format = 'json';

    // set the oauth_token or, in case none has been issued yet, the client_id
    if (oauthToken) {
      additionalParams.oauth_token = oauthToken;
    } else {
      additionalParams.client_id = clientId;
    }

    // add the additional params to the received params
    addParams(params, additionalParams, isFormData);

    // in case of POST, PUT, DELETE -> prepare data
    if (method !== 'GET') {
      data = isFormData ? params : form.encode(params);
      params = { oauth_token: oauthToken };
    }

    // prepend `/` if not present
    path = path[0] !== '/' ? `/${path}` : path;

    // construct request url
    url = `${config.get('baseURL')}${path}?${form.encode(params)}`;

    return sendAndFollow(method, url, data, progress);
  },
github soundcloud / soundcloud-javascript / src / api.js View on Github external
oEmbed (trackUrl, options = {}) {
    // save element
    const element = options.element;
    delete options.element;

    options.url = trackUrl;

    // construct URL
    const url = `https://soundcloud.com/oembed.json?${form.encode(options)}`;

    // send the request and embed response into element if provided
    return sendAndFollow('GET', url, null).then((oEmbed) => {
      if (element && oEmbed.html) {
        element.innerHTML = oEmbed.html;
      }
      return oEmbed;
    });
  },
github soundcloud / soundcloud-javascript / src / api.js View on Github external
}

    // add the additional params to the received params
    addParams(params, additionalParams, isFormData);

    // in case of POST, PUT, DELETE -> prepare data
    if (method !== 'GET') {
      data = isFormData ? params : form.encode(params);
      params = { oauth_token: oauthToken };
    }

    // prepend `/` if not present
    path = path[0] !== '/' ? `/${path}` : path;

    // construct request url
    url = `${config.get('baseURL')}${path}?${form.encode(params)}`;

    return sendAndFollow(method, url, data, progress);
  },
github Lothiraldan / saltpad / app / services / auto_updater.js View on Github external
             transformRequest: (data) => formurlencoded.encode(data)});
        return query;

form-urlencoded

Return an object as an 'x-www-form-urlencoded' string

MIT
Latest version published 6 months ago

Package Health Score

66 / 100
Full package analysis