[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
no global config possible
In the request library one can specify a global config, e.g.:
return http.defaults({
headers: {
'Accept': 'application/json',
'Content-type': 'application/json',
'User-agent': 'my-service',
'x-api-key': 'foobar',
},
});
axios has the create method, which needs to be implemented
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
We might do it like this:
imports: [
HttpModule.forRoot([config])
]
n/a
Nest version: X.Y.Z
For Tooling issues:
- Node version: 5.1.0
- Platform: Mac
Others:
n/a
Fixed by #904. Once merged, following syntax will be available:
HttpModule.register({ ...axios options here });
for example:
HttpModule.register({ timeout: 1 });
1+ need to update the docs
When can this be available?
@kamilmysliwiec, do you have any updates about this feature?
@kamilmysliwiec Why do you use register instead of forRoot? I see the same use, but forRoot is a known method
Because forRoot()
suggest that this module shall be registered in the root/app/core module. HttpModule
on the other hand, might be used in different places with different configurations.
5.2.0 is here!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Fixed by #904. Once merged, following syntax will be available:
for example:
1+ need to update the docs