In case a user does not want to reveal a segment due to it having sensitive information, it can be hard to figure out exactly what the hash for a segment is (especially when there is an encoding or related problem). So adding it to the API output can be useful for debugging.
Added the test. also added the extra urlencode for the definition. Will wait until the other pr is merged before merging this one.