WIP #16543 add directives to add or remove trailing slash

Added two directives as said in #16543.

Need to discuss:
- The location of the directives: `PathDirectives` or `RouteDirectives`?
- Returning status code to redirect: 301, 302 or make it configurable? 
- More tests
- More documentation
- etc.
Upon this discussion, I just removed hardcoded "http://example.com" with an
ad-hoc helper.

On Fri, Dec 19, 2014 at 7:37 PM, Mathias <notifications@github.com> wrote:
>
> In
> akka-http-tests/src/test/scala/akka/http/server/directives/PathDirectivesSpec.scala
> <https://github.com/akka/akka/pull/16545#discussion-diff-22098562>:
>
> > +
> > +    "pass if the request path already doesn't have a trailing slash" in {
> > +      Get("/foo/bar") ~> route ~> check { response shouldEqual Ok }
> > +    }
> > +
> > +    "redirect if the request path has a trailing slash" in {
> > +      Get("/foo/bar/") ~> route ~> check {
> > +        status shouldBe a[Redirection]
> > +        header[Location] shouldEqual Some(Location("http://example.com/foo/bar"))
> > +      }
> > +    }
> > +
> > +    "preserves the query and the frag when redirect" in {
> > +      Get("/foo/bar/?query#frag") ~> route ~> check {
> > +        status shouldBe a[Redirection]
> > +        header[Location] shouldEqual Some(Location("http://example.com/foo/bar?query#frag"))
>
> Currently yes. In which cases would you want to distinguish between
>
> GET /foo HTTP/1.1
> Host: example.com:80
>
> and
>
> GET http://example.com/bar/../foo HTTP/1.1
> Host: example.com
>
> ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/akka/akka/pull/16545/files#r22098562>.
>