If resource is given it returns something like '/posts/2' (note no ending '/') but if null given it returns '/posts/' (with ending '/'). This lead to double slashes in URLs for resources without identities e.g. '/profile//relationships/comments'.
Need more consistency. It should be no trailing '/' in all cases.