From 23151d170326dfd5e44ab988db95882ce1170362 Mon Sep 17 00:00:00 2001 From: Debora Crescenzo Date: Thu, 30 Jan 2025 14:39:13 +0000 Subject: [PATCH] MT#62025 Send Fax 422 error bugfix /api/faxes endpoint was returning a 422 error Uprocessable content. This commit amends the payload to match what is in the APIv1 documentation (old docs) Change-Id: Ib8d9c0ec41e1e1a18bbe503db711b55e5f66e050 (cherry picked from commit 47d46279803aabc7987e55b30bc6786ece876b47) (cherry picked from commit e7cbbd93f93c22512356153a441bfaf6c7b4c781) --- src/api/communication.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/api/communication.js b/src/api/communication.js index f3430ae3..f7c88eb9 100644 --- a/src/api/communication.js +++ b/src/api/communication.js @@ -1,17 +1,12 @@ import { post } from 'src/api/common' -import _ from 'lodash' export async function createFax (options) { - const formData = new FormData() - const fields = _.clone(options) - delete fields.faxfile - const json = JSON.stringify(fields) - formData.append('json', json) - if (options.faxfile) { - formData.append('faxfile', options.faxfile) + if (options.faxfile === null) { + delete options.faxfile } + return await post({ resource: 'faxes', - body: formData + body: options }) }