svrcekmichal / redux-axios-middleware

Redux middleware for fetching data with axios HTTP client
MIT License
920 stars 96 forks source link

Is it possible to send custom headers? #56

Closed ninohero closed 7 years ago

ninohero commented 7 years ago

we're trying to send custom headers for NTML authentification purposes. I've tried this

const client = axios.create({ //all axios can be used, shown in axios documentation baseURL: 'http://1.2.3.4:8080', options: { responseType: 'json', SamAccount: 'username' } });

and const client = axios.create({ //all axios can be used, shown in axios documentation baseURL: 'http://1.2.3.4:8080', options: { responseType: 'json', headers: { 'SamAccount': 'username' }; } });

but we're not seeing the headers change. the options property seems to be how it is done in the axios documentation... are there any other things that we should try?

ninohero commented 7 years ago

nevermind... it turned out that the second way above was, in fact, correct but that the server with the api had not been set up to accept the 'OPTIONS' request header...