1

I have feathers API with REST/axios. Configured like this:

const axios = require("axios");
const restClient = rest(serverPaths.serverPath.slice(0, -1));
restApi.configure(restClient.axios(axios.create({
      headers: {accessToken: '--change---me'} // this works all the time
})));

The request:

const sr = await this.$restApi.service('users').find({}, {
    headers: {
        accesstoken: '-this is a new token-' // this does not work
        }
});

However simply changing to get and it works:

const sr = await this.$restApi.service('users').get(1, {
                    headers: {
                        accesstoken: '-this is a new token-' // now it works
                    }
                });

So for get I receive: accesstoken: --change---me, -this is a new token- so both of them, which is fine, I'll just delete the first one from config file.

But that's mean I do something wrong. Something simple and stupid but I just can't figure it out what.

Note: all regular API request with axios, not using feathers services, works without problem, I can send any header I want and it just work.

SharpBCD
  • 547
  • 1
  • 7
  • 25

0 Answers0