abdelkarim's avatar
abdelkarim
New Contributor
3 days ago
Status:
New Idea

Refer to JSON payload in multipart/form-data

I need to test an endpoint accepting multipart/form-data. The endpoint expects a required part with content id "messageToSend" and optional parts with content id's "document[1-x]". The documents are to be file attachments and I want to send the "messageToSend" as a JSON payload.

The attachments are working without issue, but using the query parameter value to input my JSON is not great UX. Ideally I would be able to refer to the body below from the query param so the content id is set correctly. You can imagine if the JSON content were much larger it would be painful to use the query parameter as the text box.

As you can see in the screenshots above, the JSON payload has the correct Content-Type but no Content-Disposition. Functionally the two parts need to be merged. I either need to be able to:

  1. Refer to the JSON from the query parameter where placeholder "REFER_TO_JSON_BODY" (similar to file:fileName).
  2. Set the "content id" in the large text box with the rest of the JSON.

Kind regards

1 Comment

  • joostdgfed's avatar
    joostdgfed
    Occasional Contributor

    Hi. I think this question was already raised a long time ago at SmartBear. See Rest request attachments multipart form data for json file with parameterized json data | SmartBear Community 
    It has been logged by SmartBear as a enhancement request RIA-22427.

    I reached out a few days ago as to when this would be available in ReadyAPI. I got back following response:

    We understand your concern. Thank you for getting back to us. I’ve notified the Product team regarding this requirement and have increased the priority of the enhancement request. As you mentioned, this functionality should indeed be available within the product, and I’ll work with the team to ensure it’s considered for implementation at the earliest. Apologies for the inconvenience caused.