@@ -195,6 +195,49 @@ public void testGetLinks() {
195195 assertTrue (r .getLinks ().contains (link2 ));
196196 }
197197
198+ @ Test
199+ public void testGetLinksWithCommaInUri () {
200+ InboundMessageContext r = createInboundMessageContext ();
201+ Link link1 = Link .fromUri ("http://example.org/app/foo,bar" ).param ("produces" , "application/json" ).param ("method" ,
202+ "GET" ).rel ("self" ).build ();
203+ r .header ("Link" , link1 .toString ());
204+ assertEquals (1 , r .getLinks ().size ());
205+ assertTrue (r .getLinks ().contains (link1 ));
206+ }
207+
208+ @ Test
209+ public void testGetLinksWithMultipleLinksInOneHeaderAndCommaInUri () {
210+ InboundMessageContext r = createInboundMessageContext ();
211+ Link link1 = Link .fromUri ("https://example.org/one/api/groups?foo,page=2" ).rel ("next" ).build ();
212+ Link link2 = Link .fromUri ("https://example.org/one/api/groups?bar,page=39" ).rel ("last" ).build ();
213+ r .header ("Link" , "<https://example.org/one/api/groups?foo,page=2>; rel=\" next\" , <https://example.org/one/api/groups?bar,page=39>; rel=\" last\" " );
214+ assertEquals (2 , r .getLinks ().size ());
215+ assertTrue (r .getLinks ().contains (link1 ));
216+ assertTrue (r .getLinks ().contains (link2 ));
217+ }
218+
219+ @ Test
220+ public void testGetLinksWithMultipleLinksInOneHeader () {
221+ InboundMessageContext r = createInboundMessageContext ();
222+ Link link1 = Link .fromUri ("https://example.org/one/api/groups?page=2" ).rel ("next" ).build ();
223+ Link link2 = Link .fromUri ("https://example.org/one/api/groups?page=39" ).rel ("last" ).build ();
224+ r .header ("Link" , "<https://example.org/one/api/groups?page=2>; rel=\" next\" , <https://example.org/one/api/groups?page=39>; rel=\" last\" " );
225+ assertEquals (2 , r .getLinks ().size ());
226+ assertTrue (r .getLinks ().contains (link1 ));
227+ assertTrue (r .getLinks ().contains (link2 ));
228+ }
229+
230+ @ Test
231+ public void testGetLinksWithMultipleLinksInOneHeaderWithLtInValue () {
232+ InboundMessageContext r = createInboundMessageContext ();
233+ Link link1 = Link .fromUri ("https://example.org/one/api/groups?page=2" ).rel ("next" ).param ("foo" , "<bar>" ).build ();
234+ Link link2 = Link .fromUri ("https://example.org/one/api/groups?page=39" ).rel ("last" ).param ("bar" , "<<foo" ).build ();
235+ r .header ("Link" , "<https://example.org/one/api/groups?page=2>; rel=\" next\" ; foo=\" <bar>\" , <https://example.org/one/api/groups?page=39>; rel=\" last\" ; bar=\" <<foo\" " );
236+ assertEquals (2 , r .getLinks ().size ());
237+ assertTrue (r .getLinks ().contains (link1 ));
238+ assertTrue (r .getLinks ().contains (link2 ));
239+ }
240+
198241 @ Test
199242 public void testGetLink () {
200243 InboundMessageContext r = createInboundMessageContext ();
0 commit comments