Core preparation for NO-baseUrl-COOKIE switch

This pull request is only about small refactoring – I've removed code duplications from duality/core.

In case if this project is not dead – please take a look on [my no_baseUrlCookie-switch](https://github.com/SpeCT/duality/compare/SpeCT:master...SpeCT:no_baseUrlCookie-switch) branch. There is only one extra line of code to let developer switch baseUrl cookie off by configuring kanso.json:

```json
{
  "name": "blah", "version": "1.0", 
...
  "duality": {
    "no_baseUrlCookie": true
  }
...
}
```

The reason why I do want to turn baseUrl cookie off is next issue: [COUCHDB-1447](https://issues.apache.org/jira/browse/COUCHDB-1447). Shortly – duality prevents CouchDB from sending 'X-Couch-Update-NewRev' header from inside _update handler. Not sure if my workaround should be merged into `master`.