You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The req variable has the Accept header set to */*.
Expected behaviour: The second new RsXslt(new RsWithType(raw, "text/html")) should be returned.
Actual behaviour: The first new RsWithType(raw, "text/xml") is returned instead.
Context: After the release of Maven 3.9.0, we started experiencing problems during the build of Rultor. One of the problems was a failed test that was related to RsFork. With Maven 3.8.7, everything works fine.
It seems that the cause of the problem is MediaType.matches method:
public boolean matches(final MediaType type) {
final String star = "*";
return (this.high.equals(star)
|| type.high.equals(star)
|| this.high.equals(type.high))
&& (this.low.equals(star)
|| type.low.equals(star)
|| this.low.equals(type.low));
}
I would assume that this is the intended behavior - by supplying */* client says: "It doesn't matter to me what you send. I'll accept everything". Therefore RsFork goes with the first FkTypes, because application/xml,text/xml is a subset of everything.
The only thing I see problematic is that we are forced to duplicate code if want to make our last match-everything fork also a default fork. We'll need something similar to this:
Response rs = new RsXslt(new RsWithType(raw, "text/html"));
return new RsFork(
req,
new FkTypes(
"match_nothing/except_stars",
rs
),
new FkTypes(
"application/xml,text/xml",
new RsWithType(raw, "text/xml")
),
new FkTypes(
"*/*",
rs
)
);
We have the following routing code with
RsFork
and Maven 3.9.0:The
req
variable has theAccept
header set to*/*
.Expected behaviour: The second
new RsXslt(new RsWithType(raw, "text/html"))
should be returned.Actual behaviour: The first
new RsWithType(raw, "text/xml")
is returned instead.Context: After the release of Maven 3.9.0, we started experiencing problems during the build of Rultor. One of the problems was a failed test that was related to
RsFork
. With Maven 3.8.7, everything works fine.Environment:
The text was updated successfully, but these errors were encountered: