You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently I am generating a TS client using the NSwagStudio.
Example of one of the generated methods:
getMovie(movieId: number,signal?: AbortSignal): Promise<void>{leturl_=this.baseUrl+'/movie/{movieId}'if(movieId===undefined||movieId===null)thrownewError("The parameter 'movieId' must be defined.")url_=url_.replace('{movieId}',encodeURIComponent(''+movieId))url_=url_.replace(/[?&]$/,'')letoptions_: AxiosRequestConfig={method: 'GET',url: url_,headers: {},
signal
}returnthis.instance.request(options_).catch((_error: any)=>{if(isAxiosError(_error)&&_error.response){return_error.response}else{throw_error}}).then((_response: AxiosResponse)=>{returnthis.processGetMovie(_response)})}
All other methods look more or less the same.
I call the method like this in my code: await api.getMovie(10)
What I miss here is the ability to inject some more "AxiosRequestConfig" options. I want to be able to inject other options per request. Just to be clear, the additional options will be affecting only this particular request and not all the request.
So I could decide if I want to inject additional options or not when I call the method.
Something like this: await api.getMovie(10, {loading: true})
This options object will be merged in to the request options.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
currently I am generating a TS client using the NSwagStudio.
Example of one of the generated methods:
All other methods look more or less the same.
I call the method like this in my code:
await api.getMovie(10)
What I miss here is the ability to inject some more "AxiosRequestConfig" options. I want to be able to inject other options per request. Just to be clear, the additional options will be affecting only this particular request and not all the request.
So I could decide if I want to inject additional options or not when I call the method.
Something like this:
await api.getMovie(10, {loading: true})
This options object will be merged in to the request options.
Is this possible at all?
Beta Was this translation helpful? Give feedback.
All reactions