22
22
use Cake \Http \CorsBuilder ;
23
23
use Cake \Http \Exception \NotFoundException ;
24
24
use Cake \Log \Log ;
25
- use Cake \Routing \Router ;
26
25
use DateTime ;
27
26
use DateTimeZone ;
28
27
use InvalidArgumentException ;
@@ -1990,25 +1989,23 @@ public function withLength($bytes)
1990
1989
* ### Examples
1991
1990
*
1992
1991
* ```
1993
- * $response = $response->withAddedLink('http://example.com', ['rel' => 'prev'])
1994
- * ->withAddedLink(['controller' => 'Posts', 'action' => 'view'] , ['rel' => 'next']);
1992
+ * $response = $response->withAddedLink('http://example.com?page=1 ', ['rel' => 'prev'])
1993
+ * ->withAddedLink('http://example.com?page=3' , ['rel' => 'next']);
1995
1994
* ```
1996
1995
*
1997
1996
* Will generate:
1998
1997
*
1999
1998
* ```
2000
- * Link: <http://example.com>; rel="prev"
2001
- * Link: </posts/view >; rel="next"
1999
+ * Link: <http://example.com?page=1 >; rel="prev"
2000
+ * Link: <http://example.com?page=3 >; rel="next"
2002
2001
* ```
2003
2002
*
2004
- * @param string|array $url link-value
2003
+ * @param string $url link-value
2005
2004
* @param array $options link-param
2006
2005
* @return static
2007
2006
*/
2008
2007
public function withAddedLink ($ url , $ options = [])
2009
2008
{
2010
- $ url = '< ' . Router::url ($ url ) . '> ' ;
2011
-
2012
2009
$ params = [];
2013
2010
foreach ($ options as $ key => $ option ) {
2014
2011
$ params [] = $ key . '=" ' . $ option . '" ' ;
@@ -2019,7 +2016,7 @@ public function withAddedLink($url, $options = [])
2019
2016
$ param = '; ' . implode ('; ' , $ params );
2020
2017
}
2021
2018
2022
- return $ this ->withAddedHeader ('Link ' , $ url . $ param );
2019
+ return $ this ->withAddedHeader ('Link ' , ' < ' . $ url . ' > ' . $ param );
2023
2020
}
2024
2021
2025
2022
/**
0 commit comments