You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following on from #381 it appears the fix I submitted didn't in fact work for our use case. I'm opening this issue for discussion as I'm not sure if it is supposed to be work 🤷♂️
//App code request - notice we have query params in the URL as well as FormData$.ajax({url: '/some/url?foo=foo',type: 'POST',data: JSON.stringify({bar:'bar'})});//Mock in test - in withSomeParams we are only matching the paramsmock({url: '/some/url?foo=foo',type: 'POST'}).withSomeParams({foo: 'foo'});
The problem is if we see that the request is NOT a GET we only check the FormData values, which in this case is { bar: 'bar' } and not the values in the request params, { foo: 'foo' }. We do the comparison here
As a fix on our end we could just move the URL params inside the FormData prop but I guess a bigger question is if Factory Guy should support this or even if it's valid? jQuery seems to handle this scenario of sending both the params object and the FormData.
One solution is to combine the FormData with the query params if present? Or is it just a weird edge case?
The text was updated successfully, but these errors were encountered:
I just came across the same use case. I wonder would it be a solution to have withParams and withQueryParams functions? If you could chain them it would allow a check on both with compromising any existing functionality
Following on from #381 it appears the fix I submitted didn't in fact work for our use case. I'm opening this issue for discussion as I'm not sure if it is supposed to be work 🤷♂️
The problem is if we see that the request is NOT a
GET
we only check theFormData
values, which in this case is{ bar: 'bar' }
and not the values in the request params,{ foo: 'foo' }
. We do the comparison herehttps://github.com/danielspaniel/ember-data-factory-guy/blob/b086500dbab1b7eb510e3a177cf196cfa5c66ad0/addon/mocks/mock-any-request.js#L49-L58
As a fix on our end we could just move the URL params inside the
FormData
prop but I guess a bigger question is if Factory Guy should support this or even if it's valid? jQuery seems to handle this scenario of sending both the params object and theFormData
.One solution is to combine the FormData with the query params if present? Or is it just a weird edge case?
The text was updated successfully, but these errors were encountered: