Closed arumsey closed 2 months ago
The import service now requires multi part form data instead of JSON.
Use multipart/form-data content type to support upload of custom import.js https://github.com/adobe/spacecat-api-service/pull/487
The startButton click handler will need to be rewritten to create a form data object.
startButton
const formData = new FormData(); formData.append('urls', JSON.stringify(urlsArray)); formData.append('options', JSON.stringify(options)); formData.append('customHeaders', fields.headers.value); formData.append('importScript', fields.importScript.files[0]); const newJob = await service.startJob(formData);
The start service will then also need to be updated to accept a form data object.
const headers = new Headers(this.#getAuthHeaders()); headers.delete('Content-Type'); const resp = await fetch(`${this.endpoint}${IMPORT_JOBS_PATH}`, { method: 'POST', headers, body: formData, });
The import service now requires multi part form data instead of JSON.
The
startButton
click handler will need to be rewritten to create a form data object.The start service will then also need to be updated to accept a form data object.