cancel
Showing results for 
Search instead for 
Did you mean: 

Content-Disposition paramters

g_eijlders
New Contributor

Content-Disposition paramters

How can I add custom parameters in the Content-Disposition of a multipart/form-data request?



See example below want I want to achieve:



------=_Part_20_13894859.1421339164343

Content-Type: application/pdf; name=tekening1.pdf

Content-Transfer-Encoding: binary

Content-Disposition: form-data; name="tekening1.pdf"; filename="tekening1.pdf";custompar="test"



3 REPLIES 3
MarcusJ
Moderator

Re: Content-Disposition paramters

Hi,

 

Use the following Groovy script in the event handler RequestFilter.filterRequest:

 

def count = context.getProperty("httpMethod").requestEntity.message.content.count
for (def i=0; i < count; i++)
{
def bodyPart = context.getProperty("httpMethod").requestEntity.message.content.getBodyPart(i)
bodyPart.disposition = bodyPart.disposition + " ;custompar=\"test\""
}

 

That will add the custom pararmater to the content dispostion.  Link below gives more information on custom event handlers in Ready API.

 

 

http://readyapi.smartbear.com/loadui/scripts/intro/event_handlers

 

Regards,

Marcus

SmartBear Support



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
doogra
Occasional Visitor

Re: Content-Disposition paramters

I also have a problem where I need to add a parameter called "uploadFile" to the Content-Disposition parameters per the below example:

 

Content-Disposition: form-data; name="uploadFile"; filename="bar-12.0.2.30.bar"

 

However, I do not understand the example solution you provided. It appears to apply only to LoadUI. Can you please provide detailed steps on how to accomplish this using SoapUI Pro? I'm using verison 5.1.2. Thanks!

 

Update:

Never mind....I figured it out. Needed to manually change the contentId value in the attachments tab so that it read "uploadFile".

jjsudharsan
Occasional Contributor

Re: Content-Disposition paramters

Your solution solved my problem

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors