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

allow qs options to be passed through #1776

Closed
wants to merge 2 commits into from

Conversation

Mattchewone
Copy link
Contributor

@Mattchewone Mattchewone commented Jan 3, 2020

Allows for adding additional options for the qs.stringify method. I came to this as it's currently not possible at least from my trial and error, to be able to override the rest client so that getQuery can be extended so I can provide my own qs with options.

const feathersClient = feathers()
  .configure(restClient.fetch(fetch, {
    qsStringifyOptions: {
      strictNullHandling: true
    }
  }));

Allows for adding additional options for the qs.stringify method.
```js
const feathersClient = feathers()
  .configure(restClient.fetch(fetch, {
    qsStringifyOptions: {
      strictNullHandling: true
    }
  }));
```
@marshallswain
Copy link
Member

Looks good to me.

@daffl
Copy link
Member

daffl commented Jan 9, 2020

Thank you for the pull request @Mattchewone. I think what we'd really want to do here instead of just adding another option is being able to add a custom client service class with a customized getQuery. The API I'm thinking would look like this:

const feathers = require('@feathersjs/feathers');
const rest = require('@feathersjs/rest-client');
const { FetchClientService } =rest;

const app = feathers();class MyFetchClient extends FetchClientService {
  getQuery () {
    return {};
  }
}// Connect to a different URL
const restClient = rest('http://feathers-api.com');// Configure an AJAX library (see below) with that client 
app.configure(restClient.fetch(window.fetch, MyFetchClient));// Connect to the `http://feathers-api.com/messages` service
const messages = app.service('messages');

Also related to #1102

@Mattchewone
Copy link
Contributor Author

Closed due to newer version - #1780

@Mattchewone Mattchewone deleted the patch-1 branch January 10, 2020 15:54
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

Successfully merging this pull request may close these issues.

3 participants