-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUGFIX beta] Fixes issue with GET requests appending ?{} to url #4445
Conversation
@@ -1341,7 +1341,7 @@ if (isEnabled('ds-improved-ajax')) { | |||
hash.context = this; | |||
|
|||
if (request.data) { | |||
if (request.type !== 'GET') { | |||
if (hash.type !== 'GET') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to be request.method
instead?
Thanks for this @JeroenvdV. I think it would be good to have a test to catch future regressions for this. Can you add a test to the if (isEnabled('ds-improved-ajax')) {
test("_requestToJQueryAjaxHash works correctly for GET requests - GH-4445", function(assert) {
let done = assert.async();
let server = new Pretender();
server.get('/posts/1', function(request) {
assert.equal(request.url, "/posts/1", "no query param is added to the GET request");
return [201, { "Content-Type": "application/json" }, JSON.stringify({ post: { id: 1 } })];
});
run(function() {
let post = store.findRecord('post', 1);
post.then(function() {
server.shutdown();
done();
});
});
});
} After this, this is good to go 🚀 |
Thanks, I added your test verbatim as I'm not in a position to test it fully at the moment. |
Just one more tiny change: if you add a newline at the end of the test then ESLint is happy and this is good to be merged! |
@JeroenvdV, I should have been more clear: I meant adding a newline at the end of the test file. I am very sorry for the back and forth in this PR, I can see how that is not very motivating and I try to communicate more clearly in the future 😔 ... If you don't have time for this today, I can add the newline later manually... |
Closing in favor of rebased version #4466 |
@JeroenvdV I merged this via the rebased #4466. Thank you very much! 🚀 |
This fixes a typo in the REST adapter comparing
request.type
, which doesn't exist. Eitherrequest.method
orhash.type
was meant. The symptom is that?{}
is appended to the url of any GET requests by jQuery.