Ask a Question

Submitting a multipart/form-data request generates automatic boundary - but only on start and finish

SOLVED
richie
Community Hero

Submitting a multipart/form-data request generates automatic boundary - but only on start and finish

Hi,

 

Bit embaressed I can't sort this out cos its functionality not coding - but I'm struggling - I need to use the multipart/form-data type in a request (no other will do apparently - even though its just some text I'm sending to the server) and ReadyAPI!'s generation of the automatic boundary is causing me some real problems and I'm not the only one considering all the posts I've found on this - occasionally people have found ways around it, but the fixes cant help me as far as I could see.

This is another example where it works fine in Postman but when I try with SoapUI I have problems - I'm not saying it works correctly in Postman cos I dont actually think it does in this case, but I'm struggling with ReadyAPI!

 

Essentially I have a multiattribute payload that I MUST use the multipart/form-data type - but the automatic boundaries are ONLY generated at the header and footer of the request.  

 

My payload has the following name/value pair requirements:

grant_type:password
client_id:e621ab05-3417-4482-a1e4-de86705bfcb7
client_secret:a%2BOPsfWybHR8VBvLIbzBZCHjWhzAAbUHahJNFNWcOho%3D
resource:e621ab05-3417-4482-a1e4-de86705bfcb7
username:exportsadministrator@defrasandpit.onmicrosoft.com
password:Rojo5166!

I populate the Request form (below the mediatype dropdown) with the detail below (excepting the automatically generated boundaries wrapping the content

 

------=_Part_22_4377865.1561564369180 (AUTO GENERATED BOUNDARY)

Content-Disposition: form-data; name="grant_type" password Content-Disposition: form-data; name="client_id" e621ab05-3417-4482-a1e4-de86705bfcb7 Content-Disposition: form-data; name="client_secret" a+OPsfWybHR8VBvLIbzBZCHjWhzAAbUHahJNFNWcOho= Content-Disposition: form-data; name="resource" e621ab05-3417-4482-a1e4-de86705bfcb7 Content-Disposition: form-data; name="username" exportsadministrator@defrasandpit.onmicrosoft.com Content-Disposition: form-data; name="password" Rojo5166! ------=_Part_22_4377865.1561564369180-- (AUTO GENERATED BOUNDARY)

HOWEVER - the above fails which I'm guessing because I need boundaries BETWEEN the attributes as well as having a header/trailer boundary - so the content that works (scraped via Postman) looks as follows:

 

----------------------------819072124639882311836182
Content-Disposition: form-data; name="grant_type"

password
----------------------------819072124639882311836182
Content-Disposition: form-data; name="client_id"

e621ab05-3417-4482-a1e4-de86705bfcb7
----------------------------819072124639882311836182
Content-Disposition: form-data; name="client_secret"

a+OPsfWybHR8VBvLIbzBZCHjWhzAAbUHahJNFNWcOho=
----------------------------819072124639882311836182
Content-Disposition: form-data; name="resource"

e621ab05-3417-4482-a1e4-de86705bfcb7
----------------------------819072124639882311836182
Content-Disposition: form-data; name="username"

exportsadministrator@defrasandpit.onmicrosoft.com
----------------------------819072124639882311836182
Content-Disposition: form-data; name="password"

Rojo5166!
----------------------------819072124639882311836182--

 

Does anyone know how edit the content (or the properties of the request) to get the boundaries to appear BETWEEN the attributes as well as wrapping them? - I've tried manually adding the Content-Type : multipart/form-data; boundary=" header and played around with this - but I just can't see a way for the boundaries to generate BETWEEN the attributes.

 

 

There was a person that found a way around this via this link (by manually specifying the boundaries by specifying the boundary as a custom header (e.g. multipart/form-data; boundary="----WebKitFormBoundary7MA4YWxkTrZu0gw) as well as ensuring the boundary value wrapped the payload and was between the attributes - HOWEVER - that was a couple of years ago and it looks like there's been some coding since cos when I specify the boundary as in the link, ReadyAPI! still inserts the automatically generated header and footer boundaries - so my request is invalid.

 

I'm thinking I've found another defect for @Radford's list! 🙂

 

I'd welcome any help at all at this point - I've been playing with this for the last 4 hours with no luck!

 

cheers,

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
7 REPLIES 7
Nastya_Khovrina
SmartBear Alumni (Retired)

Hi @richie 

 

You can do the following:

1. Specify your properties as query parameters of a request.

2. Check the Post QueryString option.

3. Don't forget to clear the Request form (below the Media Type dropdown)

Please see the screenshot:

ReadyAPI_2019-07-01_13-30-12.png

 

Here is what you'll get as a result:

 

ReadyAPI_2019-07-01_13-30-33.png

 

Also, here are some useful resources:

LearnUpon: https://smartbearacademy.learnupon.com/enrollments/25031374

YouTube: https://www.youtube.com/watch?v=iL-zehJmtWw&list=PLrA5ciulugn_w0pW1_SSyfucD-k5Fasj_&index=5


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

Hey @Nastya_Khovrina 

 

Thankyou!

 

But I think I've found another defect which now I can see was causing me a lot of the problems - I kept thinking I was doing something wrong because whenever I went from Projects to SoapUI to add the request into the testcase - the parms were blank.

 

That is -  I can create the request in the Projects section adding the payload in as query parms - and submit the request using the type and query parms as you suggest within the Projects tab only and the request is successful.

 

HOWEVER - when I go into the SoapUI tab - and add the new request to the testcase the parameters are BLANK - i.e. they're not present - and I can't alter the parms on a request in the SoapUI tab - if I go back into the Projects tab - I can see my request with the queryparms as created before.

 

@Nastya_Khovrina can you please try and replicate this? - it's quite a hindrance if you can't actually use the request within a testcase when the type is 'multipart/form-data'!

 

Thank you for all your help! 🙂

 

rich

 

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Nastya_Khovrina
SmartBear Alumni (Retired)

Hi rich,

 

Yes, I can reproduce this behavior, but, this is by design. When working with tests, you may want to specify different parameter values.

 

 


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

Hi @Nastya_Khovrina,

I'm sorry i obviously wasn't clear in my previous message. I didn't mean the parameter values....absolutely they need to be altered within the SoapUI tab. I meant the parameters (the names) themselves. When i add in the parms and values in the ReadyAPI! tab, i can submit the request successfully.
However once i go into the SoapUI tab and select the request as a test step, the parameter list is blank....i dont mean the values are blank....i mean there are no parametes listed at all!

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Nastya_Khovrina
SmartBear Alumni (Retired)

Hi @richie,

 

Thank you for the clarification. I cannot reproduce the issue on my side, please see my sample video:

https://1drv.ms/u/s!AnCx6DcSb33_lwss662lFHZvBoSC.

Are you sure that you're selecting the correct request? If this still doesn't work for you, please open a new case here: and provide us with the details about the issue: your ReadyAPI version, screenshots, project, etc. Also, please clarify whether the issue is specific for a project or service.

 

Also, I tried with the parameter values (not parameters itself) - they are added as well.


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

Hey @Nastya_Khovrina 

 

Yeah - i'm definitely selecting the correct request when I add in the teststep.  I have already raised a tech support ticket with SmartBear and they're looking at it now.

 

I should highlight that I have this behaviour in a couple of my projects - but not all.  I've recreated the issue in 3 of my projects - but I couldn't recreate the issue in several other projects - so the behaviour appears to be peculiar to specific projects.

I've tried reviewing the project file to identify the differences between the projects that dont display the erroneous behaviour and those that do - but I'm drawing a blank I'm afraid!

 

Thanks for attempting to reproduce!

 

ta,

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Nastya_Khovrina
SmartBear Alumni (Retired)

You're welcome. Yes, please continue working on the issue in the corresponding support case. 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: