Skip to content

Commit

Permalink
#1899 - Test case to reproduce unquoted link attribute parsing bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
kdefives authored and odrotbohm committed Feb 15, 2023
1 parent 698ec7c commit 08b48f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/java/org/springframework/hateoas/LinksUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ class LinksUnitTest {
static final Links reference2 = Links.of(Link.of("/something", "foo").withHreflang("en"),
Link.of("/somethingElse", "bar").withHreflang("de"));

// #1899
static final String FIVE = "</somethingElse>;rel=boo";
static final String SIX = "</somethingElse>; rel=bee";
static final String LINKS3 = StringUtils.collectionToCommaDelimitedString(Arrays.asList(FIVE, SIX));
static final Links reference3 = Links.of(Link.of("/somethingElse", "boo"), Link.of("/somethingElse", "bee"));

@Test
void parsesLinkHeaderLinks() {

Expand Down Expand Up @@ -264,6 +270,11 @@ void supportsUnquotedAttributes() {
.isEqualTo("https://url.com?page=1");
}

@Test // #1899
void parsesMultipleLinksContainingUnquotedRels() {
assertThat(Links.parse(LINKS3)).isEqualTo(reference3);
}

@Value(staticConstructor = "of")
static class NamedLinks {
String name;
Expand Down

0 comments on commit 08b48f6

Please sign in to comment.