Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xml content type fix #760

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added bin/soapui-5.7.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import static com.eviware.soapui.support.JsonUtil.seemsToBeJsonContentType;

Expand Down Expand Up @@ -628,7 +630,15 @@ public void setEditable(boolean enabled) {

@Override
public int getSupportScoreForContentType(String contentType ) {
return contentType.toLowerCase().endsWith("xml")? 2 : 0;
if(contentType.endsWith("xml")){
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the standard behaviour for application/xml or else.

return 2;
}
Optional<String> any = Arrays.stream(contentType.split(";"))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is other stuff like charset or boundard or both, we get rid of that and do the check again.

.map(String::toLowerCase)
.filter(txt -> !txt.contains("charset"))
.filter(txt -> !txt.contains("boundary"))
.findAny();
return any.filter(s -> s.toLowerCase().endsWith("xml")).map(s -> 2).orElse(0);
}

protected ValidationError[] validateXml(String xml) {
Expand Down