They are asking me to send some data through the post method. Here is the code first:
addImage(image, params): Observable<any> {
const httpOptions = {
headers: new HttpHeaders({
'Authorization': this.token,
'Content-Type': 'multipart/form-data',
'Content-Disposition': `form-data; filename=${image.name}`
})
};
this.data = params;
this.data.file = image;
return this.http.post(this.url , this.data, httpOptions);
The request like this is not worth it, I think that what they expect to receive is the data of a form (a form that does not exist, nor will it exist). Is there any way to simulate what that input would look like. That is, how to simulate the input that the form would give us when launched?
All the best.
What you have to do is create a FormData and add the image like so:
and add the rest of the form values in a similar way: