ember-cli / ember-ajax

Service for making AJAX requests in Ember applications
MIT License
212 stars 87 forks source link

allow host and namespace be empty #425

Open artemgurzhii opened 5 years ago

artemgurzhii commented 5 years ago

Allow host and namespace be empty strings?

// app/services/ajax.js
export default AjaxService.extend({
  host: 'https://my-awesome-app.com',
  namespace: '/api/v1',
});
// Some controller/component action
this.ajax.request('/some-url', { namespace: '/' });

// Expected: GET 'https://my-awesome-app.com/api/v1/some-url'
// Result:   GET 'https://my-awesome-app.com/api/v1/some-url'

this.ajax.request('/some-url', { namespace: '' });

// Expected: GET 'https://my-awesome-app.com/some-url'
// Result:   GET 'https://my-awesome-app.com/api/v1/some-url'

Is there any reason for not using Ember.isNone check?