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

addQs method can't find this method from jquery '$.param' #7

Closed
lucio-c opened this issue Jul 6, 2016 · 6 comments
Closed

addQs method can't find this method from jquery '$.param' #7

lucio-c opened this issue Jul 6, 2016 · 6 comments

Comments

@lucio-c
Copy link

lucio-c commented Jul 6, 2016

No description provided.

@olofd
Copy link
Owner

olofd commented Aug 11, 2016

@cuixiaolu Please give some more information regarding this. Preferably submit a PR.

@olofd olofd closed this as completed Aug 11, 2016
@olofd olofd reopened this Aug 11, 2016
@jonoirwinrsa
Copy link

jonoirwinrsa commented Sep 8, 2016

This error occurs when trying to add headers as an object to the connection query string eg:
connection.qs = { 'Bearer' : token };
connection.start()...

If you send the headers as a serialised string it works alright

@olofd
Copy link
Owner

olofd commented Oct 24, 2016

Sry for late response. Do you guys have any idea how to fix this? I can take a look this coming week, but I would want a bit more code that will reproduce the issue.

@jonoirwinrsa
Copy link

In my case I ended up not needing the query strings so I'm afraid I don't have a fix..

@olofd
Copy link
Owner

olofd commented Oct 25, 2016

Ah. Ok. Then, if it's okay with you I'll close this for now. If more people report or have this issue we can open it again.

@olofd olofd closed this as completed Oct 25, 2016
@thomasvm
Copy link

thomasvm commented Jan 27, 2017

I've encountered the same scenario, needed the .qs for authentication to work on signalr hubs. Ended up adding the following code to my own project in order to polyfill jQuery.param. This only supports very basic objects no nested objects

jQuery.param = (obj) => {
  const str = [];
  for (const p in obj) {
    if (obj.hasOwnProperty(p)) {
      str.push(
        `${encodeURIComponent(p)}=${encodeURIComponent(obj[p])}`
      );
    }
  }
  return str.join('&');
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants