Ask a Question

SoapUI POST/PUT without media type - is this supported

dabrochu
New Contributor

SoapUI POST/PUT without media type - is this supported

Using SoapUI 1.7.0

 

A bug was found in one of our APIs due to the Spring Framework version we upgraded to. The issue is that when a POST or PUT is provided without providing Content Type: application/json, a 415 is returned. This was introduced in a newer version of Spring.

 

Anyhow, I'd like to set up tests such that we could test for this going forward. It appears however that by default when creating a POST or PUT in SoapUI that media type is set to application/json. I am able to change the value of this in the dropdown, but I can't seem to find a way to neglect to send the header all together. Is this currently possible? If so, how?

 

Thanks!

1 REPLY 1
MarcusJ
Moderator

Hi,

 

You can ue a Groovy script to remove the header in an event handler.

 

Using RequestFilter.filterRequest event handler:

 

context.getProperty("httpMethod").removeHeaders("Content-Type") // remove Content-Type header

 

http://readyapi.smartbear.com/readyapi/events/start

 

Regards,

Marcus

SmartBear Support

 

 


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: