Added support for building URLs with optional parameters

Fixes some of the issues mentioned in #290
Another fix + removed console logs
Added tests, based on abergs tests
Fixed issue with trailing slashes
Tidied tests and removed debug prints
Fixed issue with regex allowing ":va?lue" instead of just ":value?"
Merge pull request #395 from dancannon/patch-1

[fixed] Added support for building URLs with optional parameters