File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 10
10
### Removed
11
11
- Deprecated option ` debug_plugins ` has been removed from ` PluginClient `
12
12
13
- ## 1.8.2 (unreleased)
13
+ ## 1.8.2 - 2018-12-14
14
14
15
15
### Changed
16
16
17
17
- When multiple cookies exist, a single header with all cookies is sent as per RFC 6265 Section 5.4
18
+ - AddPathPlugin will now trim of ending slashes in paths
18
19
19
20
## 1.8.1 - 2018-10-09
20
21
Original file line number Diff line number Diff line change @@ -46,12 +46,24 @@ public function it_adds_path(
46
46
$ this ->handleRequest ($ request , PluginStub::next (), function () {});
47
47
}
48
48
49
- public function it_throws_exception_on_trailing_slash (UriInterface $ host )
50
- {
49
+ function it_removes_ending_slashes (
50
+ RequestInterface $ request ,
51
+ UriInterface $ host ,
52
+ UriInterface $ host2 ,
53
+ UriInterface $ uri
54
+ ) {
51
55
$ host ->getPath ()->shouldBeCalled ()->willReturn ('/api/ ' );
56
+ $ host2 ->getPath ()->shouldBeCalled ()->willReturn ('/api ' );
57
+ $ host ->withPath ('/api ' )->shouldBeCalled ()->willReturn ($ host2 );
58
+
59
+ $ request ->getUri ()->shouldBeCalled ()->willReturn ($ uri );
60
+ $ request ->withUri ($ uri )->shouldBeCalled ()->willReturn ($ request );
61
+
62
+ $ uri ->withPath ('/api/users ' )->shouldBeCalled ()->willReturn ($ uri );
63
+ $ uri ->getPath ()->shouldBeCalled ()->willReturn ('/users ' );
52
64
53
65
$ this ->beConstructedWith ($ host );
54
- $ this ->shouldThrow (\LogicException::class)-> duringInstantiation ( );
66
+ $ this ->handleRequest ( $ request , function () {}, function () {} );
55
67
}
56
68
57
69
public function it_throws_exception_on_empty_path (UriInterface $ host )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public function __construct(UriInterface $uri)
33
33
}
34
34
35
35
if ('/ ' === substr ($ uri ->getPath (), -1 )) {
36
- throw new \ LogicException ( ' URI path cannot end with a slash. ' );
36
+ $ uri = $ uri -> withPath ( rtrim ( $ uri -> getPath (), ' / ' ) );
37
37
}
38
38
39
39
$ this ->uri = $ uri ;
You can’t perform that action at this time.
0 commit comments