Forum Discussion
SmartBear_Suppo
SmartBear Alumni (Retired)
Hi,
looking at your code, the following line does not look correct:
You are using the content object (http://www.soapui.org/apidocs/com/eviwa ... ntent.html) which does not have the BomStrip method.
I would actually suggest you use another object from Bom maven plugin that you can instantiate and strip out UTF-8 BOMs here - http://www.java2s.com/Code/Jar/b/Downlo ... cesjar.htm
API ref: http://site.kuali.org/maven/plugins/bom ... index.html
looking at your code, the following line does not look correct:
content = content.BomStrip(content)
You are using the content object (http://www.soapui.org/apidocs/com/eviwa ... ntent.html) which does not have the BomStrip method.
I would actually suggest you use another object from Bom maven plugin that you can instantiate and strip out UTF-8 BOMs here - http://www.java2s.com/Code/Jar/b/Downlo ... cesjar.htm
API ref: http://site.kuali.org/maven/plugins/bom ... index.html
adiman
10 years agoVisitor
Hi all,
I had this problem recently and here is how I solved it:
Add a RequestFilter.afterRequest event and use the code below. The code strips the first char from the response. It doesn't check if the char is indeed the BOM, but strips it if the encoding is UTF-8. This assumes you always know your UTF-8 responses contain the BOM.
Be careful with the script, it will run for every request that you send. Add other exit conditions to the begining of the event that suit your purpose.
if( context.httpResponse.responseContent == null ) return if(context.httpResponse.responseHeaders.get("Content-Encoding").toString() != "[utf-8]") return // get response content def content = context.httpResponse.responseContent // manipulate content // remove the first char from the response (in this case the utf-8 BOM) content = content.substring(1,content.length()) // write it back context.httpResponse.responseContent = content
Related Content
- 3 years agoariyan_79
- 4 years agozacka
- 8 years agodanielmbanks
- 9 years agoMBratukhin