Open feelgood-interface opened 2 years ago
Hey! Are there any updates? Has there been any progress on the issue?
This issue is crucial. Please update us!
I just ran into this issue as well. I had to add a hack as a workaround using an axios interceptor:
image2(projectId: string, file: FileParameter | undefined, signal?: AbortSignal | undefined): Promise<void> {
let url_ = this.baseUrl + "/api/project/{projectId}/image";
if (projectId === undefined || projectId === null)
throw new Error("The parameter 'projectId' must be defined.");
url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId));
url_ = url_.replace(/[?&]$/, "");
const content_ = new FormData();
if (file === null || file === undefined)
throw new Error("The parameter 'file' cannot be null.");
else
content_.append("file", file.data, file.fileName ? file.fileName : "file");
let options_: AxiosRequestConfig = {
data: content_,
method: "POST",
url: url_,
headers: {
},
signal
};
return this.instance.request(options_).catch((_error: any) => {
if (isAxiosError(_error) && _error.response) {
return _error.response;
} else {
throw _error;
}
}).then((_response: AxiosResponse) => {
return this.processImage2(_response);
});
}
instance.interceptors.request.use((config) => {
if (config.url?.includes("/image")) {
config.headers.set("Content-Type", "multipart/form-data")
}
return config;
});
Good day, I am generating a TypeScript client (axios template) for the following documentation (i.e. I am trying to upload a file):
However, the 'multipart/form-data' content header or
content_.getHeaders()
are not added to the header options: